3 ms·
I have never ever ever seen a null inside an Optional -- the most common constructor actually Optional::ofNullable makes the correct decision, so you can't even
by kaba0 3y ago
I have never ever ever seen a null inside an Optional -- the most common constructor actually Optional::ofNullable makes the correct decision, so you can't even fck it up, and if you deliberately try to, I'm sure intellij would scream your head off.
- waynesonfire 3y agoThe reason you've never seen it is because it won't let you, private Optional(T value) { this.value = Objects.requireNonNull(value); }
- jen20 3y agoThe problem is whether the optional itself is null, not whether the contained value is.
- kaba0 3y agoThat’s not a problem either.