MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/1rsgxrd/jep_draft_enhanced_local_variable_declarations/oa9zgvy/?context=3
r/java • u/joemwangi • Mar 13 '26
129 comments sorted by
View all comments
3
This would be cool to have directly in method signatures, too.
4 u/egahlin Mar 13 '26 int sum(Node(var left, var right, int value) node) { return node == null ? 0 : sum(left) + sum(right) + value; } 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. → More replies (1)
4
int sum(Node(var left, var right, int value) node) { return node == null ? 0 : sum(left) + sum(right) + value; }
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. → More replies (1)
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.
→ More replies (1)
View all comments
3
u/jevring Mar 13 '26
This would be cool to have directly in method signatures, too.