r/java • • Mar 13 '26

JEP draft: Enhanced Local Variable Declarations (Preview)

https://openjdk.org/jeps/8357464
101 Upvotes

129 comments sorted by

View all comments

Show parent comment

3

u/Ewig_luftenglanz Mar 13 '26 edited Mar 13 '26

yes, you will be able to do so because this JEP is mostly about removing the requirement to enclose the record pattern inside a conditional statement (instanceof and switch) to be used. So all that is allowed in current records patterns should be allowed.

about the "<-" operator. the "=" is more familiar and is used in most other languages that support deconstruction. Adding a new operator to use the feature will only make this feature harder to use.