NullPointerExceptions on unboxing
June 24, 2006
As of JDK 5, you can get NullPointerExceptions on weird places, such as
Map<String, Integer> lookupTable = new HashMap<String, Integer>();
int value = lookupTable.get("key");
Since there are no entries in the lookupTable, the get returns a null value. The unboxing of a null value throws a NullPointerException.