The Java Stream API was introduced with Java 8 in March 2014, providing us with an indispensable tool for data processing.
However, the limited set of intermediate operations – `filter`, `map`, `flatMap`, `mapMulti`, `distinct`, `sorted`, `peak`, `limit`, `skip`, `takeWhile`, and `dropWhile` – means that more complex data transformations cannot be expressed directly through the Stream API.
Operations like window and fold, among many others, are missing if we look at the community's feature requests.
Instead of integrating all these operations into the Stream interface, the JDK team developed a new API that, on the one hand, is used within the JDK itself to provide highly requested intermediate operations and, on the other hand, allows developers to implement their own operations.
This new API is called "Stream Gatherers" and was first released as a preview feature (JEP 461) in Java 22 in March 2024, exactly ten years after the introduction of the Stream API. In Java 23, the new API was sent into a second preview round without changes (JEP 473), and in Java 24, it was finalized – again without changes (JEP 485).
In this talk, you will learn in theory and practice (including live coding) what Stream Gatherers are and how they work, which Gatherers are already available in the JDK and how to use them effectively, how to implement your own Gatherers, and where the limits of the new API lie.