Package net.jrodolfo.java_evolution.java21
package net.jrodolfo.java_evolution.java21
Examples for features introduced in Java 21.
Java 21 is an LTS release and a major modern-Java milestone. It finalized virtual threads for scalable blocking code, record patterns for deconstructing data, pattern matching for switch for type-based dispatch, and sequenced collections for ordered collection operations. It also included preview work for unnamed patterns/variables, scoped values, and structured concurrency, plus the Key Encapsulation Mechanism API.
-
ClassDescriptionExplains the Key Encapsulation Mechanism API introduced in Java 21.Demonstrates pattern matching for switch, finalized in Java 21.Closed command hierarchy used to demonstrate exhaustive switch handling.Restarts a service.Starts a service.Stops a service.Demonstrates record patterns, finalized in Java 21.Point record used by the nested deconstruction example.Rectangle record made of two points.Explains scoped values as a Java 21 preview feature.Demonstrates sequenced collections, introduced in Java 21.Explains structured concurrency as a Java 21 preview feature.Demonstrates unnamed patterns and variables as a Java 21 preview feature.Demonstrates virtual threads, finalized in Java 21.