Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
conro1108
· 3y ago · 0 comments
Optional.of(null) throws a NullPointerException ;)
Optional.ofNullable(null) == Optional.empty()
Comments
[–]
vanjajaja1
3y ago
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.