Exploring Collectors: A Powerful Utility Class in the JDK
summary
Shows how java.util.stream.Collectors solves reduce problems: use toList and toUnmodifiableList to avoid shared-mutable accumulation, use Collectors.joining(",") to build comma‑separated uppercase names without trailing commas, use partitioningBy for boolean splits and groupingBy + mapping to bucket by name or age, use collectingAndThen(counting(), Long::intValue) to get int counts, and mentions filtering, flatMapping and Java 14 teeing; recommends unit tests and refactor-from-imperative approach.
AI-written summary · about
chapters (9)
- 0:00Introduction to Collectors
- 6:45Why use Collectors
- 11:18Basic Collector functions
- 18:23Partitioning collections
- 22:17Grouping collections
- 31:58Advanced grouping with mapping
- 39:47Complex transformations
- 47:07Flat mapping and teeing
- 51:02Refactoring with tests
related talks
55mExploring Collectors
02h 25mExploring Collectors
02h 47mCollectors in the wild!
01h 57mJourney’s End: Collection and Reduction in the Streams API
44mI didn't know you could do that with Java Streams!
01h 01mTransforming Data using the Functional API
30mCollections Refueled
49mJava Streams: Beyond The Basics
