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.
one plus one
Shared publicly•View activity