Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
wrongOptionalUse
static class Customer {
private final String firstName;
private final String surname;
private final Optional<Integer> age;
private final Optional<String> address;
private final Optional<String> phoneNumber;
private final Optional<Sex> sex;
public Customer(String firstName, String surname, Optional<Integer> age, Optional<String> address, Optional<String> phoneNumber, Optional<Sex> sex) {
this.firstName = firstName;
this.surname = surname;
this.age = age;
this.address = address;
this.phoneNumber = phoneNumber;
this.sex = sex;
}
public String getFirstName() {
return firstName;
}
public String getSurname() {
return surname;
}
public Optional<Integer> getAge() {
return age;
}
public Optional<String> getAddress() {
return address;
}
public Optional<String> getPhoneNumber() {
return phoneNumber;
}
public Optional<Sex> getSex() {
return sex;
}
}
static enum Sex {
FEMALE,
MALE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment