Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
conro1108
3y ago
0 comments
Save
Share
Optional.of(null) throws a NullPointerException ;)
Optional.ofNullable(null) == Optional.empty()
0 comments
1 comments · 1 top-level
top
newest
oldest
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.
j
/
k
navigate · click thread line to collapse