There are 3 different cases of
var v: T = null
:
v
is an
optional
value
- use
Option[T]
type, which is idiomatic and type safe,
v
is an
uninitialized
value (a value must be assigned)
- use
_
as initializer, which is clear, concise, and platform-independent,
it's a performance
optimization
(you actually use
null
value)
- explicitly suppressed the inspection for the unsafe code.