| Optional types are clumsy when compared to modern alternatives: - Optional does not protect from NPE, null is still allowed - It adds extra layer of complexity - some libraries use it, some do not. it is not enforced - extra typing, Java does not even have type inference and `val` declaration - `if` expression in java does not return a value, no pattern matching... again far more typing - no support for chained call on several nullable fields I use Kotlin for couple of years. It has nullability baked into type system and enforced by the compiler. And it works with existing java libraries. It feels like going back 15 years to Java 1.4, when I use Optional in Java8 or Scala. |