Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Last active December 16, 2015 03:09
Show Gist options
  • Save chris-martin/5367445 to your computer and use it in GitHub Desktop.
Save chris-martin/5367445 to your computer and use it in GitHub Desktop.
interface Optional<T> {
T get();
boolean isPresent();
void ifPresent(Consumer<? super T> consumer);
T orElse(T other);
T orElseGet(Supplier<? extends T> other);
<X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment