Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benweidig/8239d52f808fac802e8b9fb6ff1971bb to your computer and use it in GitHub Desktop.
Save benweidig/8239d52f808fac802e8b9fb6ff1971bb to your computer and use it in GitHub Desktop.
Optional<String> withValue = Optional.of("definitly a string");
if (withValue.isPresent()) {
System.out.println("There's definitly something there!");
}
Optional<String> noValue = Optional.empty();
if (noValue.isPresent() == false) {
System.out.println("No, nothing...");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment