Local Variable Type Inference: Friend or Foe?


Duration: 50 mins
Simon Ritter
Deputy CTO, Azul Systems

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 boiler-plate 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 aswell 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.

You may also be interested in

50 mins
Go-ing Further

Go is a fascinating language. While it is simple, it makes some rather interesting decisions on several language features that...

50 mins
A Dozen Cool Things We Can Do With Popular JVM Languages

Languages offer a lot more than syntax and compilers. They often have supporting libraries and special facilities that set them...

50 mins
The Magic of Delegates in Kotlin

Very many good books on OO design have advised us to choose delegation over inheritance. Yet, most developers using OO...

25 mins
Practical Approaches To Scaling Distributed Transactions

Application development platforms have evolved to a state where several features available within an Environment are now assumed to be...

180 mins
Rust Workshop

Rust has quickly become an incredibly popular language with exceptional tooling, documentation and a renowned community that welcomes and helps...

180 mins
Migrating to Modern JavaScript

Today, JavaScript is ubiquitous. However, for a long time, JavaScript was deemed quirky and eccentric. Developers had to resort to...