Skip to content

Instantly share code, notes, and snippets.

@agustarc
Created February 5, 2017 08:48
Show Gist options
  • Save agustarc/49b71b6cc30bd0a2bfd561486834cd25 to your computer and use it in GitHub Desktop.
Save agustarc/49b71b6cc30bd0a2bfd561486834cd25 to your computer and use it in GitHub Desktop.
Optional<Cart> optional = Optional.ofNullable(response.getCart()).orElse(new Cart());
Optional<Cart> optional = Optional.ofNullable(response.getCart()).orElseThrow(IllegalStateException::new);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment