Going Beyond Java 8: Local Variable Type Inference (var)

According to some surveys, such as JetBrains's great survey, Java 8 is currently the most used version of Java, despite being a 2014 release.

What you are reading is one in a series of articles titled 'Going beyond Java 8,' inspired by the contents of my book, Java for Aliens. These articles will guide you step-by-step through the most important features introduced to the language, starting from version 9. The aim is to make you aware of how important it is to move forward from Java 8, explaining the enormous advantages that the latest versions of the language offer.

Local Variable Type Inference: Declare Var, Not War

Java is changing rapidly, and with the six-month release cycle, we are getting new features to try with every release. In Java 10, local variable type inference was added. It was basically aimed at reducing boilerplate code and improving readability when declaring local variables with initializers.

Programs must be written for people to read and only incidentally for machines to execute
Harold Abelson