4 ms·
Luckily it's not too late. A C#/Kotlin approach could be introduced and would not interfere with existing Optional. The type system would need to be extended w
by dtech 5y ago
Luckily it's not too late. A C#/Kotlin approach could be introduced and would not interfere with existing Optional.
The type system would need to be extended with a T? (nullable), T! (non-nullable), smart-casting on null-checks, and with some annotations or a flag to determine if T should be treated as T? or T! and whether you can call methods on it.
> How is this better?
It's not if you use Optional.get, but if you use .map, .orElse and the like the compiler can prevent you from getting NPEs instead of them being runtime.