Re:All New Java Language Features Since Java 21
by cokely on Saturday September 06, 2025 @02:15PM
(#45151589)
Yeah I generally avoid using 'var' to elide method return types for that reason. In my early phase of var enthusiasm I even had it result in a bug that would have been caught if the type had been made explicit.
I do still really like it in the `var list = new ArrayList<String>()` case though.
I do still really like it in the `var list = new ArrayList<String>()` case though.