☕ Sealed classes for type hierarchies
Restrict which classes can extend a type — enabling exhaustive switches.
Open Hierarchy → sealed permits (JDK 17 )
🔗 javaevolved.github.io/langua…#Java#JavaEvolved
☕ Module import declarations
Import all exported packages of a module with a single declaration.
Many Imports → import module (JDK 25 )
🔗 javaevolved.github.io/langua…#Java#JavaEvolved
☕ Pattern matching for instanceof
Combine type check and cast in one step with pattern matching.
instanceof Cast → Pattern Variable (JDK 16 )
🔗 javaevolved.github.io/langua…#Java#JavaEvolved
☕ Optional.ifPresentOrElse()
Handle both present and empty cases of Optional in one call.
if/else on Optional → ifPresentOrElse() (JDK 9 )
🔗 javaevolved.github.io/stream…#Java#JavaEvolved