...

/

Local Variable Types and Lambda Expressions

Local Variable Types and Lambda Expressions

Learn about lambda expressions and local variable types in Java 10 and 11.

A little history

Java 10 was released on March 20, 2018. Java 11 was released in September 2018. As Java 11 is the long-term service release (LTS), many developers may move directly from Java 8.

The main substantial update of Java 10 was Local Variable Type Inference (var). It also included enhancements for garbage collection and compilation, but that will not affect how we write our code.

Local variable types

Although var is not a new keyword, it is a context-sensitive type and represents a huge leap forward for Java developers. It allows us to substitute a ...