Why Java decided to allow ‘null’ as a key in HashMap? As we know hashcode() can’t be calculated on null value. Is there any design consideration for this decision to allow null key in HashMap which is not there in Hashtable(Other than considering as a default value)?
Share
From the JDK 1.2 Java Collections API Change Summary (not sure where to find the official version on Oracle’s website):
Joshua Bloch and Doug Lea disagreed on this, and this caused problems for concurrent hash maps.