Which one is faster:
Either this
try {
n.foo();
}
catch(NullPointerException ex) {
}
or
if (n != null) n.foo();
Beside the good answers (use exceptions for exceptional cases) I see that you're basically trying to avoid the null checks everywhere. Java 7 will have a "null safe" operator that will return null when n?.foo() is called instead of throwing a NPE. That's borrowed from the Groovy language. There's also a trend to avoid using null altogether in one's code except when really needed (ie: dealing with libraries). See this other answer for more discussion on this.
Avoiding != null statements