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
Kotlin: Coroutines And More

This talk will examine features of Kotlin at a greater depth than most tutorials. Coroutines – the most popular feature...

50 mins
JavaScript the Grumpy Parts

We love JavaScript, but we must admit: it's weird.  Why does 'this' behave as it does?  How does variable scope...

180 mins
Kotlin Basics and Beyond Workshop

Kotlin is the definitive language for Android development, but it can be used anywhere a Java Virtual Machine is available....

180 mins
Rust Workshop

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

50 mins
Go Microservices in Containers

Cloud native containers allow smaller teams to embrace polyglot. We can now choose the best languages and tools to solve...

25 mins
Bringing Reactive Programming to Java and Microservices

Reactive programming is all about non-blocking applications that are asynchronous and event-driven. It also leads to a major shift from...