我正想通过Java的实现了哈希表的put方法和遇到这样的:为什么哈希表店在Java中的表中的键的哈希值
// Makes sure the key is not already in the hashtable.
Entry tab[] = table;
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry<K,V> e = tab[index] ; e != null ; e = e.next) {
if ((e.hash == hash) && e.key.equals(key)) {
V old = e.value;
e.value = value;
return old;
}
}
虽然我明白,一个关键需要检查冲突,为什么Java存储密钥的哈希值并检查它?