Java 10 and Local-Variable Type Inference

Robert Rice Development Technologies, Java Leave a Comment

JDK 10, an implementation of Java Standard Edition, was released in March 2018. It brought with it Local-Variable Type Inference to help simplify the writing of Java applications.

Basically, it’s a new syntax meant to reduce some of Java’s verbosity, while still maintaining the enforcement of static type safety. In simpler terms, you are able to declare variables, but won’t necessarily have to specify the type.

In this blog, I give recommendations for best practice when using Local-Variable Type Inference in JDK 10 with an eye for common var pitfalls…