Skip to content

Instantly share code, notes, and snippets.

@harukizaemon
Created October 1, 2014 06:11
Show Gist options
  • Save harukizaemon/91454cd1edde3e28f5f0 to your computer and use it in GitHub Desktop.
Save harukizaemon/91454cd1edde3e28f5f0 to your computer and use it in GitHub Desktop.
if (myOptionalThing.isPresent()) {
myOptionalThing.get().doSomething();
}
// vs
myOptionalThing.ifPresent(MyOptionalThing::doSomething);
// vs
if (myThing != null) {
myThing.doSomething();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment