☕ Record patterns (destructuring)
Destructure records directly in patterns — extract fields in one step.
Manual Access → Destructuring (JDK 21+)
🔗
#Java#JavaEvolved
☕ Pattern matching for instanceof
Combine type check and cast in one step with pattern matching.
instanceof + Cast → Pattern Variable (JDK 16+)
🔗
#Java#JavaEvolved
☕ String.lines() for line splitting
Use String.lines() to split text into a stream of lines without regex overhead.
split("\\n") → lines() (JDK 11+)
🔗
#Java#JavaEvolved
☕ Spring Framework 7 API Versioning
Replace duplicated version-prefixed controllers with Spring Framework 7's native API ver…
Manual URL Path Versioning → Native API Versioning (JDK 17+)
🔗
#Java#JavaEvolved
Want to see how Java evolved, feature by feature? ☕️
@brunoborges built an amazing site that shows Java language changes side by side—perfect for students and devs modernizing legacy apps.
Check it out:
🔗
#Java#SoftwareEngineering#JavaEvolved
☕ Unmodifiable collectors
Collect directly to an unmodifiable list with stream.toList().
collectingAndThen → stream.toList() (JDK 16+)
🔗
#Java#JavaEvolved
☕ Module import declarations
Import all exported packages of a module with a single declaration.
Many Imports → import module (JDK 25+)
🔗
#Java#JavaEvolved
☕ Optional.ifPresentOrElse()
Handle both present and empty cases of Optional in one call.
if/else on Optional → ifPresentOrElse() (JDK 9+)
🔗
#Java#JavaEvolved
☕ Text blocks for multiline strings
Write multiline strings naturally with triple-quote text blocks.
String Concatenation → Text Blocks (JDK 15+)
🔗
#Java#JavaEvolved