Old Java hired a whole anonymous class to say "compare by length"; modern Java hands over a sticky note — a lambda, (a, b) -> ... — that may
only capture variables that never change, because it may run later (Ch 1). Every note needs a slot: a functional interface with exactly one
abstract method, and the standard slots — Predicate, Function, Consumer, Supplier, BiFunction, UnaryOperator — cover almost everything and
even compose (Ch 2). When the note only calls one existing method, you just write its name: a method reference like Student::name (Ch 3).
A stream is a conveyor belt: a source, intermediate stations that each return a new stream, and a terminal operation that produces the
result, never touching the source and never reusable (Ch 4). The stations — filter, map, flatMap for flattening nested lists, sorted, distinct,
reduce — turn Part 0's fifteen lines into four (Ch 5), and collectors pack the output: lists, groups, counts, averages, joined strings, partitions, and
maps with a merge function for duplicate keys (Ch 6). The belt is lazy — elements travel one at a time and only as far as needed — primitive streams
avoid boxing, and parallel streams split work across cores, helping big CPU-bound jobs and hurting almost everything else (Ch 7).
Optional is the gift box that might be empty — a return type that makes "not found" impossible to ignore, with orElseGet for costly defaults
because orElse always evaluates its argument (Ch 8). Around them sit var, text blocks, switch expressions with yield, and small String and List
additions (Ch 9). And Java 17–21's biggest change, sealed types with pattern-matching switches — type patterns, record patterns, when guards,
case null — gives closed families of types whose every switch the compiler checks for completeness (Ch 10). The version map shows where each piece arrived
(Ch 11).
Next, Concurrency puts several CPU cores to work safely — the threads, locks and race conditions of Operating Systems, in real Java.