β AOT class preloading
Cache class loading and compilation for instant startup.
Cold Start Every Time β AOT Cache (JDK 25+)
π https://t.co/xtrzfZdIcf
#Java#JavaEvolved
β Diamond with anonymous classes
Diamond operator now works with anonymous classes too.
Repeat Type Args β Diamond <> (JDK 9+)
π https://t.co/mT9PQWvFcE
#Java#JavaEvolved
β Record-based error responses
Use records for concise, immutable error response types.
Map or Verbose Class β Error Records (JDK 16+)
π https://t.co/2anhgnshLH
#Java#JavaEvolved
β Switch expressions
Switch as an expression that returns a value β no break, no fall-through.
Switch Statement β Switch Expression (JDK 14+)
π https://t.co/g3FPDVnHJp
#Java#JavaEvolved
β JUnit 6 with JSpecify null safety
JUnit 6 adopts JSpecify @NullMarked, making null contracts explicit across its assertion API.
Unannotated API β @NullMarked API (JDK 17+)
π https://t.co/QVpNR1Jqfe
#Java#JavaEvolved
β Text blocks for multiline strings
Write multiline strings naturally with triple-quote text blocks.
String Concatenation β Text Blocks (JDK 15+)
π https://t.co/ozRDnGbumI
#Java#JavaEvolved
β Primitive types in patterns
Pattern matching now works with primitive types, not just objects.
Manual Range Checks β Primitive Patterns (JDK 25+)
π https://t.co/h3s91hWiE2
#Java#JavaEvolved
β Instant with nanosecond precision
Get timestamps with microsecond or nanosecond precision.
Milliseconds β Nanoseconds (JDK 9+)
π https://t.co/GUan38y34T
#Java#JavaEvolved
β Null case in switch
Handle null directly as a switch case β no separate guard needed.
Guard Before Switch β case null (JDK 21+)
π https://t.co/TcQndtXOhs
#Java#JavaEvolved
β Unmodifiable collectors
Collect directly to an unmodifiable list with stream.toList().
collectingAndThen β stream.toList() (JDK 16+)
π https://t.co/TFzqYxelL3
#Java#JavaEvolved
β Path.of() factory
Use Path.of() β the modern factory method on the Path interface.
Paths.get() β Path.of() (JDK 11+)
π https://t.co/jBnqyIgELv
#Java#JavaEvolved
β Optional.orElseThrow() without supplier
Use Optional.orElseThrow() as a clearer, intent-revealing alternative to get().
get() or orElseThrow(supplier) β orElseThrow() (JDK 10+)
π https://t.co/8pK34mT2Rn
#Java#JavaEvolved