Talk type: Talk

Local variable type inference: Friend or foe?

  • Talk in English

Local variable type inference was introduced as a new Java language feature in Java SE 10. Gone are the days of explicitly having to define the type of a variable; let the compiler do it for you with the magic of var!

At first sight, this looks like a small change that will eliminate unnecessary boilerplate code and reduce how much typing (on the keyboard) is required to maintain strong typing (of the language). However, as with many features, there are some unexpected nuances as well as both good and bad use cases.

In this session, we'll explain the fundamentals of local variable type inference. We'll then take a series of examples of the use of var and discuss the technical merits of each case.

  • #best practices
  • #var

Speakers

Talks