3 ms·
the intension is that the Optional reference is not null (despite it being _possible_ due to how references work in java). And it's fairly easy to add annotatio
by chii 7y ago
the intension is that the Optional reference is not null (despite it being _possible_ due to how references work in java). And it's fairly easy to add annotations like @NotNullable or some other compile time annotation which can be checked very easily by an IDE or other tool.
- erik_seaberg 7y agoThere's a very special level of hell for people who use both Optional.empty() and (Optional<?>) null for different things.
- chii 7y agoJust to play the devils' advocate, what happens if you want to represent the absence of having a value? that is, the Optional is not None (because it hasn't been computed yet).
- erik_seaberg 7y agoSpecial. Hell. (Actually that sounds like a Future<Optional<T>> or something.)
- swish_bob 7y agoIf you create a null reference to an Optional in any code base I have to deal with I will hunt you down and hurt you.
- MockObject 7y agoNo jury of peers would convict.