Chapter 2Using Collections

If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it.

Richard Pattis

We often use collections of numbers, strings, and objects. They are so commonplace that removing even a small amount of ceremony from coding collections can reduce code clutter greatly. In this chapter we explore the use of lambda expressions to manipulate collections. We use them to iterate collections, transform them into new collections, extract elements from them, and easily concatenate their elements.

After this chapter, our Java code to manipulate collections will never be the same—it’ll be concise, expressive, elegant, and more extensible than ever before.

Get Functional Programming in Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.