4 ms·
> you didn't mention the case of an optional that contains null That's not possible in Java. `Optional.ofNullable(null)` returns `Optional.empty()`, and `Optio
by mhaymo 11y ago
> you didn't mention the case of an optional that contains null
That's not possible in Java. `Optional.ofNullable(null)` returns `Optional.empty()`, and `Optional.of(null)` throws a NullPointerException.
- nrinaudo 11y agoAh, good to know, thanks for pointing that out.