1 min readSep 15, 2020
There is much more efficient approach: https://dev.to/siy/consistent-null-values-handling-in-java-3c5e
Conceptually it's the same approach as in Kotlin - separate nullable and non-nullable types. Once this is done, compiler can detect issues at compile time.