【发布时间】:2012-12-11 19:01:22
【问题描述】:
Java HashMap 实现在 Entry 私有类中有“下一个”成员。因为,键的新值将覆盖旧值,Entry 类中“下一个”成员的用途是什么。
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;
}
.....
}
【问题讨论】: