I would like to migrate this legacy Java example code to Java 8.
public String getUserSex(Person person) {
if(person != null) {
if(person.getSex() != null) {
return person.getSex();
}
}
return null;
}
How to migrate this to Java 8 using Optional?