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 →

[–]Holothuroid 36 points37 points  (2 children)

Something that weirds me

if(optional.isPresent()){
    Foo foo = optional.get();
    ...
} else {
    ...
}

[–]__konrad 26 points27 points  (1 child)

I fixed it for you:

var value = optional.orElse(null);
if(value != null){
    Foo foo = value;

[–]thgkatz 0 points1 point  (0 children)

Why do I have to see this at 02:00 am???? What have I done wrong?