Idiomatic Java 25 Expressions
Records and sealed interfaces for pattern matching, functional interfaces and method references in place of classic callback hierarchies, and the Builder and static-factory idioms from Effective Java.
Records, sealed interfaces, and pattern matching
A shipping rating engine built from three closed, sealed record hierarchies, ParcelKind, ShippingEvent, and RateRule, operated on by exhaustive pattern-matching switches that use type patterns, a guarded when clause, and record deconstruction patterns nested three levels deep, with no visitor interface and no accept() method anywhere.
Enums, functional interfaces, streams, and Optional as patterns
A nightly shipment fulfillment batch, run entirely through everyday Java 25 constructs: an enum carrying its own algorithm, a lambda satisfying the identical contract, a function standing in for a class hierarchy, composed pricing adjustments, a stream pipeline, and Optional as an explicit answer instead of null.
Where Java 25 retires classic idioms
The through-line pulled together: an enum singleton retiring double-checked locking, a record retiring a hand-written value class and its defensive copying, a sealed interface with an exhaustive switch retiring Visitor and the instanceof chain, and Optional retiring the Null Object, all in modern Java 25 against one shipping domain.