Question: how null key is stored in hashmap?
Answer: from HashMap: public V put(K key, V value) { if (key == null) return putForNullKey(value); ... From the source code of HashMap, if the key is null it is handled differently. There is no hashcode generated for null, but it is uniquely stored at index 0 in an internal array with hash value 0.