Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created June 11, 2020 09:13
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 theboreddev/d56f480a014a1f0567a92d430fd9f8ca to your computer and use it in GitHub Desktop.
Save theboreddev/d56f480a014a1f0567a92d430fd9f8ca to your computer and use it in GitHub Desktop.
customerWithNullOptionals
final Customer customerWithNullOptionals = new Customer(
"John",
"Smith",
null,
null,
Optional.of("01234 567890"),
Optional.of(Sex.MALE)
);
System.out.println(customerWithNullOptionals.getAddress().orElse("No address present!"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment