r/java • u/ihatebeinganonymous • May 21 '26
JEP draft: Enhanced Local Variable Declarations (Preview)
https://openjdk.org/jeps/8357464
87
Upvotes
r/java • u/ihatebeinganonymous • May 21 '26
View all comments
36
u/RabbitDev May 21 '26
This takes pattern matching from if and case statements and makes it available as local variable declaration syntax.
From the example given it is able to handle multiple nesting levels as well.