# java-21
7 posts
Java 21 — Scoped Values — The ThreadLocal Replacement
Understand Java's Scoped Values — why they replace ThreadLocal, how they work with virtual threads, and practical patterns for request-scoped data.
Java 21 — Structured Concurrency
Understand Java's Structured Concurrency API — StructuredTaskScope, ShutdownOnFailure, ShutdownOnSuccess, and how it prevents thread leaks in concurrent code.
Java 21 — Sequenced Collections — Finally, a First/Last API
Java 21's Sequenced Collections add getFirst(), getLast(), and reversed() to List, Set, and Map — the API Java has been missing for 25 years.
Java 21 — Record Patterns & Sealed Classes in Practice
Use Java 21's record patterns and sealed classes together — destructuring records in switch, nested patterns, and building type-safe domain models.
Migrating from Java 17 to 21 — What Breaks, What Improves
A practical migration guide from Java 17 to 21 — breaking changes, deprecated removals, new features to adopt, and step-by-step upgrade process.
Java 21 — Pattern Matching for switch (Exhaustive & Guarded)
Master Java 21's pattern matching for switch — type patterns, guarded patterns, null handling, exhaustiveness, and practical examples for cleaner code.
Java 21 — Virtual Threads Explained with Real Examples
Understand Java virtual threads — how they work, when to use them, migration from thread pools, and real-world performance comparisons with platform threads.