☕ 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