3 ms·
The problem I have with his example is that I would probably want to do this: Person person = dataSource.getPersonById(personId); if (person != null) {
by fexl 13y ago
The problem I have with his example is that I would probably want to do this:
Person person = dataSource.getPersonById(personId);
if (person != null) {
person.setPhoneNumber(phoneNumber);
dataSource.updatePerson(person);
} else {
user.notify("That's an invalid ID.");
}
So I need an "else", in effect, regardless of whether it's implemented as a conditional, block, lambda, exception, or whatever.