|
|
|
|
|
by hedora
3431 days ago
|
|
Hey, don't knock it! Maybe I want a null reference to an Optional<int> to mean something different than a non-null reference to an optional that contains a null reference to a boxed Integer. Database theory tells us that having multiple null values is useful ("eh, I don't know" vs "your question has no meaning"). Seriously though, it would be great if they just added a "non null reference" type to the language. C++ has this, and it is useful (even though the compiler doesn't enforce the non-null bit). The thing that always irked me about Optional<T> is that they are synonymous with bare Java references (which also can be null, at least according to the language spec / compiler). It is like a Java version of #define THIS_PROGRAM_IS_WRITTEN_IN_C * to my eyes. To each their own. |
|