Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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