Journey’s End: Collection and Reduction in the Streams API
summary
Shows how the Streams Collectors replace unsafe mutable accumulators with a supplier/accumulator/combiner trio, walks the Collectors factory methods (toList, toSet, toMap, joining, counting, averagingInt, summarizingDouble), and demonstrates composition like groupingBy with downstream collector to count, average or join names per key. Presents a custom, parallel-ready collector that builds Oprah book shelf cumulative offsets (no shared accumulator) and notes performance hotspots: map resizing and combiner merges are expensive but the approach works.
AI-written summary · about
chapters (11)
- 0:00Introduction to collectors
- 2:31Stream fundamentals
- 6:10Short-circuiting operations
- 12:41Reduction explained
- 20:22Reduction with identity
- 29:19Predefined collectors
- 37:11Custom collections
- 43:02Grouping and partitioning
- 52:33Thread-safe collection
- 1:10:29Practical examples
- 1:45:12Writing custom collectors
related talks
02h 25mExploring Collectors
55mExploring Collectors
53mExploring Collectors: A Powerful Utility Class in the JDK
44mI didn't know you could do that with Java Streams!
02h 47mCollectors in the wild!
44mLevel Up Your Java Streams with Gatherers
40mStream Gathers - The biggest change to Java Streams since 10 years
45mStream Gatherers
