Advanced
Advanced & Idiomatic
Tier 5 of the Java book — functional Java, concurrency and the memory model, I/O, modern idioms, and shipping. The Streams API, threads and the happens-before rule, high-level concurrency and virtual threads, the JIT and GC, NIO.2 files, how the modern features compose into data-oriented design, and testing/build/packaging. Every example compiled and run.
Suggest an editAdvanced & Idiomatic
This is Tier 5, the summit. With the full language and the standard library behind you, these eight chapters cover what separates competent Java from idiomatic, production-grade Java: declarative data processing with streams, the hard truths of concurrency — races, coordination, and the Java Memory Model — how the JVM actually runs and reclaims your code, modern file I/O, the way the modern type-system features compose into one coherent style, and the testing, tooling, and packaging that ship it.
Eight chapters, in order:
- Functional Java & the Streams API — lazy pipelines, collectors,
Optional, and the parallel-stream hazard. - Concurrency: the Basics — what a thread is, race conditions,
synchronized, and happens-before. - Concurrency: Coordination —
wait/notify, a real deadlock and its escapes,ReentrantLock, latches, semaphores, andBlockingQueue. - Concurrency: High-Level & Virtual Threads — executors, atomics,
CompletableFuture, and virtual threads. - The Java Memory Model & Performance —
volatile, happens-before in depth, safe publication, the JIT, and garbage collection. - I/O, Files & NIO.2 —
Path/Files, the stream name clash, and bytes vs characters. - Modern Java Idioms & the Type System — records + sealed + patterns as one data-oriented design.
- Testing, Tooling & Packaging — JUnit 5, build tools, dependencies, and executable JARs.
Every code block with a ▶ Run button is live; the concurrency, performance, and tooling chapters include real captured runs (a data race, JIT and GC logs, a mvn test summary) where behavior is nondeterministic or project-level. The habit that matters most at this tier is knowing the cost: streams, parallelism, immutability, and abstractions all have trade-offs, and senior judgment is choosing them deliberately.
📘 How to read the Intuition boxes. Each one is built in three moves:
- The mechanism — what the compiler and the JVM are actually doing.
- A concrete bite — a specific, runnable failure (often a real compiler error), shown so the trap is visible.
- The earned rule — the decision heuristic, now justified rather than asserted, plus its cost.