Re:When to use var in Java 10
by tqh on Saturday August 01, 2020 @12:52PM
(#24021927)
Another benefit is it removes a lot of otherwise unneccessary imports.
I think var should be used anywhere where the righthand-side expression is clear. Compare
var str = new String();
to
var waat = HERE.be().dragons("purple");
And with Spring-like classes like 'StaticFactoryBananaMakerBuilder', declaring the class makes it less readable.
I think var should be used anywhere where the righthand-side expression is clear. Compare var str = new String(); to var waat = HERE.be().dragons("purple");
And with Spring-like classes like 'StaticFactoryBananaMakerBuilder', declaring the class makes it less readable.