Collectors in the wild!
summary
Collector API in JDK 8 gets used to replace many stream terminal patterns by composable collectors, with concrete demos on a 120,000‑line article file: groupingBy + downstream builds histograms, Collectors.counting and summarizingInt compute counts/means in one pass, code finds year 2004 has ~7,600 articles and one author ~1,400 articles, pair counting finds duos >200. Implements a custom filtering collector, shows Optional.stream to drop empties, and points out Java 9 adds collectors for filtering/flatMapping; examples and utilities land on GitHub.
AI-written summary · about
chapters (20)
- 0:00Start
- 0:40Why Should We Be Interested in Characters
- 5:36Overview of the Stream Api
- 6:01Collector Api
- 8:19Mapping Operation
- 8:30Filtering Operation
- 8:50Flattening Operation with the Flat Map Method
- 11:19Stateless Operation
- 13:26How Can I Tell an Intermediate Operation from a Terminal Operation
- 16:08Collect Method
- 16:49Joining Collector
- 27:23Grouping by Character
- 48:00Parallelization
- 51:46String Builder
- 55:25Method Extraction
- 1:17:39Collector Interface
- 1:25:55Intermediate Operation
- 1:28:16Demo
- 1:52:26Optional Objects
- 2:03:28Characteristics of an Optional
related talks
55mExploring Collectors
02h 25mExploring Collectors
53mExploring Collectors: A Powerful Utility Class in the JDK
44mI didn't know you could do that with Java Streams!
01h 57mJourney’s End: Collection and Reduction in the Streams API
45mHunting with Stream Gatherers
01h 01mTransforming Data using the Functional API
51mHunting with Stream Gatherers
