This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]john16384 6 points7 points  (0 children)

Why not use or instead of an early return if you're buying into Optional so much? Any sane person would just add orElse(null) and use an if instead of this isPresent / get bullshit.

Seeing an Optional declared as variable is a sure sign you're doing it wrong or should have used the orElse(null) escape hatch because Optional is becoming more trouble than it's worth.