Java HashMap实现在Entry私有类中具有"下一个"成员.因为,键的新值将覆盖旧值,在Entry类中使用"next"成员是什么.
static class Entry<K,V> implements Map.Entry<K,V> {
final K key;
V value;
Entry<K,V> next;
final int hash;
/**
* Creates new entry.
*/
Entry(int h, K k, V v, Entry<K,V> n) {
value = v;
next = n;
key = k;
hash = h;
}
.....
}
Run Code Online (Sandbox Code Playgroud)