Hacker News new | ask | show | jobs
by conro1108 1195 days ago
Optional.of(null) throws a NullPointerException ;)

Optional.ofNullable(null) == Optional.empty()

1 comments

I'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.