Exploring Collectors
summary
Argument: the JDK Collectors API replaces error-prone manual mutation with composable, parallel-safe reductions. Live-coded specifics show filter/map/reduce chains, using toList vs toUnmodifiableList to get safe immutable results, joining to emit comma-separated strings without trailing commas, and groupingBy with downstream collectors (mapping, counting, collectingAndThen) to build maps of lists, counts or transformed values. Example totals (doubled evens sum to 60) and set vs list ordering illustrate practical, working behavior.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 2:40Filter and Map
- 10:22Purity
- 17:18Reduce function
- 23:20To unmodifiable list
- 25:26Create people
- 28:45Collect
- 31:50Functional Programming
- 33:35Partitioning
- 38:27Grouping
- 48:45Counting
related talks
02h 25mExploring Collectors
53mExploring Collectors: A Powerful Utility Class in the JDK
02h 47mCollectors in the wild!
01h 57mJourney’s End: Collection and Reduction in the Streams API
01h 01mTransforming Data using the Functional API
44mI didn't know you could do that with Java Streams!
30mCollections Refueled
54mParallel-Ready Java Code: Managing Mutation in an Imperative Language
