« All Java trainings

Java Streams Advanced – Gatherers, Spliterators & More

Duration: 2 days
Format: virtual or on-site

Overview

In this two-day advanced course, you’ll learn how to gain a deep understanding of the Java Stream API and how to apply advanced techniques like custom collectors, gatherers, and spliterators effectively.

Day one focuses on advanced collectors and aggregation techniques. You’ll explore how reduce(), groupingBy(), and downstream collectors work – and how to implement your own custom collectors tailored to your specific requirements. You’ll also develop an intuition for when parallel streams makes sense – and where to avoid common pitfalls.

On day two, we dive into the world of spliterators and the new Gatherers API introduced in Java 22. You’ll learn how to efficiently partition large datasets with custom spliterators, and how to build powerful streaming operations with stream gatherers, including use cases like sliding windows and folding.

Hands-on exercises and a final refactoring workshop ensure that you can apply your knowledge directly – with real value for your projects.

Request in-house training »

👉 Not yet confident with Streams? Then check out Java Streams Basics – Practical Foundations for Beginners.

👉 Want the full spectrum of the Stream API in one go? Then the Combined Training Java Streams Basics + Advanced is the right fit for you.

Target Audience

This course is for experienced Java developers who have already worked with Streams and now want to explore more advanced topics.

If you use Streams regularly, want to improve your code – or are curious about custom Collectors, Gatherers, or Spliterators – this course is for you.

Course Details

Duration: 2 days
Date by arrangement
Exclusively for your team
Delivered on-site or online
Customizable content
Language: English or German
Certificate of completion included

Pricing

On-site:  € 4.360,–
plus trainer travel expenses
Virtual:  € 3.590,–
Prices exclude VAT and any customization fees.

Agenda

Topics are structured progressively. We alternate between advanced theory, practical use cases, and hands-on exercises – always focused on performance, readability, and maintainability.

Advanced Collectors and Reduce Operations

  • Aggregation with reduce(): concepts and practical use
  • Debugging with peek(): when it’s helpful and when not
  • Grouping: groupingBy(), partitioningBy()
  • Downstream collectors: counting(), summingInt(), averagingDouble()
  • Nested grouping and complex aggregations
  • Joining strings with joining()
  • Hands-on: complex data analysis with collectors

Building Custom Collectors

  • Understanding the Collector interface: supplier(), accumulator(), combiner(), finisher()
  • Characteristics: CONCURRENT, IDENTITY_FINISH, UNORDERED
  • Implementing simple custom collectors
  • More complex use cases: collecting custom objects
  • Hands-on: writing your own collectors

Stream Performance and Spliterator Basics

  • When to use streams vs. traditional loops
  • Performance pitfalls: boxing/unboxing, long pipelines
  • Parallel streams: when they make sense, common fork/join pool
  • Memory efficiency and large datasets
  • Understanding spliterators and their role
  • Spliterator characteristics: ORDERED, SIZED, SUBSIZED, CONCURRENT, etc.
  • How characteristics affect stream performance

Legacy Code Refactoring Workshop

  • Refactoring session: transforming loops into streams
  • Identifying good refactoring candidates
  • Step-by-step transformation of legacy code
  • Performance comparisons: before vs. after
  • Readability vs. performance trade-offs
  • When refactoring is worthwhile – and when it’s not
  • Hands-on: multiple legacy scenarios

Advanced Stream Patterns and Custom Spliterators

  • Conditional operations with Optional
  • Error handling in streams
  • Implementing custom spliterators for specific data structures
  • Spliterator patterns: tryAdvance(), trySplit(), estimateSize()
  • Improving parallelism with custom spliterators
  • File streams: reading lines, directory walking
  • Infinite streams: generate(), iterate()
  • Hands-on: building a custom spliterator

Stream Gatherers (Java 22+)

  • What are stream gatherers and why were they introduced
  • Understanding the Gatherer interface: integrator(), combiner(), finisher()
  • Built-in gatherers: fold(), scan(), windowFixed(), windowSliding()
  • Implementing your own gatherers
  • State management in gatherers
  • Hands-on: building gatherers for specific use cases

Integration and Architecture Patterns

  • Streams in repository patterns
  • Functional programming principles with streams
  • Designing stream-based APIs
  • Migration strategies: legacy code to streams
  • Anti-patterns and debugging: avoiding common mistakes
  • Testing stream-based code

Workshop and Problem Solving

  • Complex real-world project: end-to-end stream pipeline
  • Code review session: analyzing participant code
  • Performance tuning based on real examples
  • Q&A and individual use cases
  • Summary of best practices

Request In-House Training

Inquiry Training Specific Course (#31)

Your Trainer: Sven Woltmann

Sven Woltmann

I’m a Java expert with over 20 years of experience – as a developer, architect, CTO, performance coach, and trainer.

I’ve designed enterprise-scale systems for companies like 1&1, IONOS, and ICE Services, modernized legacy apps, and helped teams build robust, maintainable, and high-performance Java software.

With HappyCoders.eu, I’ve built one of the most widely read Java blogs in the German-speaking world. I speak at conferences and Java User Groups – and often receive praise for making complex technical topics easy to understand.

What you’ll get from my courses:

  • Extensive experience: Deep Java knowledge with real-world expertise
  • Practical focus: Plenty of hands-on exercises drawn from actual project work
  • Knowledge sharing: Space for your questions, discussions, and real-life challenges
  • Tailored to your team: Content can be flexibly adapted to your goals

I don’t just teach features – I show you how to develop better software with a deep understanding of Java.

More about me »

Format & Requirements

Related Trainings