Shared publicly  - 
 

Articles like this is where bad Java style comes from.

In real life you:

use commons APIs to check for empty objects, collections, etc;
treat exceptions like they are, well, exceptional and not like they are form of "if" statement;
never test Enumeration values for equality using object.equals();
dont use assert class like shown. You just add more complexity and gain nothing but exchange NPE for IAE.
and so on and so on. 



http://www.javacodegeeks.com/2012/06/avoid-null-pointer-exception-in-java.html
Null Pointer Exception is the most common and most annoying exception in Java. In this post I want to avoid this undesired exception. First let's create example that raise Null Pointer Exception p...
1
Matt Taylor's profile photo
 
Agree, this is a wrongheaded article.  Personally I'm becoming increasingly enamored of Google Guava's immutable datatypes and functional-style programming to deal with this class of problems.  Nulls suck, but I think they are mostly an artifact of having mutable data structures.
Add a comment...