It's a bit of an in-joke at this point (but PHP could really be a better language).
public Person findPerson(String name)
{
for (Person p : personList)
{
if (p.getName().equals(name))
{
return p;
}
}
throw new PersonNotFoundException(name);
}
We can be sure that the return value of findPerson will never be null, as it must either return the correct value or throw an exception. Whether this is better, worse, or the same as a null check is debatable.