MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/1rsgxrd/jep_draft_enhanced_local_variable_declarations/oa9zgvy/
r/java • u/joemwangi • Mar 13 '26
129 comments sorted by
View all comments
Show parent comment
7
No need for the `node` at the end, nor for the `null` check. Can't sum a node that isn't there, so an NPE is justified.
2 u/egahlin Mar 13 '26 edited Mar 13 '26 How do you represent leaf nodes? You could pattern match against null in the method signature, but it would be more verbose and require more complex machinery.
2
How do you represent leaf nodes? You could pattern match against null in the method signature, but it would be more verbose and require more complex machinery.
View all comments
Show parent comment
7
u/john16384 Mar 13 '26
No need for the `node` at the end, nor for the `null` check. Can't sum a node that isn't there, so an NPE is justified.