Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Better Java Streams with Gatherers in JDK 24 - Lecture 23

Java via YouTube

Overview

Learn about Gatherers, a new addition to Java 8's Stream API introduced in JDK 24, through a comprehensive video tutorial that provides in-depth coverage of Stream API operations. Master the fundamentals through step-by-step examples ranging from basic to complex implementations. Explore internal workings of intermediate and terminal operations, discover flat-mapping techniques for stream element validation, and understand how to use mapMulti() to optimize stream object creation. Gain insights into managing internal mutable states, stream interruption mechanisms, and parallelization concepts. Follow along with detailed demonstrations of custom gatherer creation, including mapping gatherers, interrupting gatherers with mutable states, sliding window implementations, and parallel gathering techniques. The tutorial includes extensive code examples and practical applications, complemented by timestamps for easy navigation through specific topics and links to additional resources including the JEP 485 specification and related Java documentation.

Syllabus

Introduction
Introducing the Stream API
Connecting a Stream to a source of data
Calling method on a Stream
Making the difference intermediate and terminal operations
Triggering the computation with a terminal operation
Producing elements with an intermadiate operation
Validating elements with flatMap and mapMulti
Terminating a stream with an intermediate operation
Delaying the start of a computation with an internal mutable state
Bufferzing stream elements in an intermadiate operation
Methods you should only use for debugging
Characteristics of a Stream
Using forEach for debugging
Reducing a stream with count, min, max, sum, or average
Short-circuiting a stream with terminal operations
Reducing a stream in a mutable container with a collector
Creating your own Collector from a supplier, and an accumulator
Adding a finisher to a Collector to create non modifiable containers
Using collectors outside of the Stream API
Going parallel with Streams
Using parallel streams with SIZED and SUBSIZED sources
Sharing mutable state in parallel streams
Reducing parallel streams with associative reductions
Choosing to use parallel streams
Modeling intermediate stream operations with Gatherers
Writing a mapping Gatherer
Writing an interrupting Gatherer holding an internal mutable state
Managing the stream interruption with your integrator
Optimizing a Gatherer with a greedy integrator
Writing a sliding window Gatherer
Writing a correct windowing Gatherer with a finisher
Implementing a parallel Gatherer with a combiner
Adding the combiner to enable parallel gathering
Using non-parallel Gatherers in parallel Streams
Wrapping up Gatherers
That's it for today, talk to you soon!

Taught by

Java

Reviews

Start your review of Better Java Streams with Gatherers in JDK 24 - Lecture 23

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.