Summary

In this chapter, we used the different versions of the collect() method provided by the Stream framework to transform and group the elements of a Stream. This and Chapter 7, Processing Massive Datasets with Parallel Streams – The Map and Reduce Model, teach you how to work with the whole stream API.

Basically, the collect() method needs a collector that processes the data of the stream and generates a data structure returned by the set of aggregate operations that forms the stream. A collector works with three different data structures—the class of the input elements, an intermediate data structure used while processing the input elements, and a final data structure that is returned.

We used the different versions of the collect() method ...

Get Mastering Concurrency Programming with Java 8 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.