I was reading an article linked from a slashdot story, and came across this little tidbit:
Take the latest version of Java, which tries to make null-poi
If this is not a performance issue for you, you can write
public String getFirstName(Person person) { try { return person.getName().getGivenName(); } catch (NullPointerException ignored) { return null; } }