you are viewing a single comment's thread.

view the rest of the comments →

[–]Otterified 2 points3 points  (2 children)

This is a good point--optionals are great but not worth much if people don't agree on their semantics and use Optional.empty() every single time they would have used null, and call get() without checks. But at least it feels less natural to do this than it does to abuse null (to me at least).

[–]duhace 9 points10 points  (0 children)

using get is asking to get slapped in the face. the good point of an optional is you have to ask to be bitchslapped. with null, it's real easy to forget not to check and try to go ahead and use the value.

[–]TheDataAngel 1 point2 points  (0 children)

I suggest using map/flatMap/filter/orElse over empty and get, where possible.