There is a bunch of new features in this release, but I have a clear personal favourite: local variable inference. Just have a look:
var obvious = 1;
What is the type of obvious?
Over time we evolved a bit:
There is, naturally, a catch: where are the generics in the last example? I think it’s fair not to expect the compiler to use a crystal-ball.jar, so
var generics = new ArrayList<String>();
Generics will be a
now, as expected. One last catch – this will trigger IntelliJ et al to suggest returning an ArrayList instead of List, but I guess this will get better over time.