Java 21 Features
Clean, structured and easy-to-navigate Java reference
Java 21 Features
|
Category |
Feature |
Description |
|
Language Features |
Record Patterns (finalized) |
Deconstruct records directly in pattern matching. |
|
Pattern Matching for switch (finalized) |
Enables type patterns and guarded patterns in switch. |
|
|
String Templates (preview) |
Simplifies string interpolation with template expressions. |
|
|
Unnamed Classes and Instance main Methods |
Simplifies Java for beginner-friendly code (preview). |
|
|
Scoped Values |
Safe, efficient alternatives to thread-local variables. |
|
|
Virtual Threads & Concurrency |
Virtual Threads (finalized) |
Lightweight threads to simplify high-throughput concurrent programming. |
|
Structured Concurrency (preview) |
Simplifies managing concurrent tasks in structured blocks. |
|
|
Libraries & APIs |
Sequenced Collections |
Adds consistent ordering APIs to collections (e.g., first(), last()). |
|
Key Encapsulation Mechanism (KEM) APIs |
Adds new encryption APIs for modern cryptographic use cases. |
|
|
Performance / VM |
Generational ZGC |
Adds generation support to ZGC for better memory performance. |
|
Deprecations |
Deprecate Windows 32-bit x86 Port |
Marks the 32-bit Windows port for future removal. |