The code refers to the following articles:
- English: Java Streams (with Examples)
- German: Java Streams (mit Beispielen)
All examples work on the same data model: the records Book and Author, the enum Genre, and the Library class with eleven public-domain classics.
Every class with a main() method is one chapter of the article and prints the outputs shown there. Run one with java -cp target/classes eu.happycoders.streams.<ClassName> after mvn compile:
Ch1Intro– the same task as a loop and as a stream; the anatomy of a stream pipelineCh2Lambdas– lambda expressions, method references, functional interfacesCh3Sources– creating streams from collections, arrays, ranges, files, and generatorsCh4Intermediate–filter(),map(),flatMap(),mapMulti(),distinct(),sorted(),limit(),skip(),takeWhile(),dropWhile(),peek(),gather()Ch5Terminal–forEach(),collect()and collectors,toList(),toArray(),reduce(),count(),min(),max(),findFirst(),anyMatch(), and the othersCh6Lazy– lazy evaluation: element-by-element processing, short-circuiting, stateful operations, single useCh7Parallel– parallel streamsCh8Mistakes– common mistakes and how to avoid them
The code requires Java 25 or newer.
Stay up-to-date with the latest Java features with this free PDF Cheat Sheet!
- Avoid lengthy research with this concise overview of all Java versions from Java 10 to Java 27.
- Discover the innovative features of each new Java version, summarized on a single page.
- Impress your team with your up-to-date knowledge of the latest Java version.
👉 Download the free Java Versions PDF
(Hier geht's zur deutschen Version → Java-Versionen PDF)
With this free 1-page PDF cheat sheet, you'll always have the 7 most important complexity classes at a glance.
- Always choose the most efficient data structures and thus increase the performance of your applications.
- Be prepared for technical interviews and confidently present your algorithm knowledge.
- Become a sought-after problem solver and be known for systematically tackling complex problems.
👉 Download the free Big O Cheat Sheet
(Hier geht's zur deutschen Version → O-Notation Cheat Sheet)
👉 Want to stay on top of modern Java? Sign up for the HappyCoders newsletter – Modern Java: new versions & features, performance, and JVM insights – once a month.
(Hier geht's zur deutschen Version → HappyCoders-Newsletter deutsch)
🇩🇪 An alle Java-Entwickler:innen, die durch fundierte Kenntnisse über Datenstrukturen besseren Code schreiben wollen
Trage dich jetzt unverbindlich auf die Warteliste von „Mastering Data Structures in Java“ ein, und erhalte das beste Angebot!


