Java – hashcode of null key in HashMap
•
Java
I just read the difference between HashMap and hashtable classes in Java There I found a difference. The former allows null keys and later does not have the same permissions
Solution
From HashMap:
public V put(K key,V value) { if (key == null) return putForNullKey(value); ...
If you look further, you will see that null always goes to bin 0
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码