4 ms·
Optional.of(null) throws a NullPointerException ;) Optional.ofNullable(null) == Optional.empty()
by conro1108 4y ago
Optional.of(null) throws a NullPointerException ;)
Optional.ofNullable(null) == Optional.empty()
- vanjajaja1 4y agoI'm trying to say that .of(null) and .empty() semantically the same, which is why it throws NPE to force explicit empty. ofNullable is a whole other kettle of fish.