removing all e in bucket, "use" should decrease
删除槽中所有元素后,hash表占用变量use需要减1。
This commit is contained in:
parent
63e2dd2ff1
commit
d4eac2fdcd
@ -142,12 +142,14 @@ public class HashTable<K, V> {
|
||||
}
|
||||
|
||||
Entry pre;
|
||||
Entry<K, V> headNode = table[index];
|
||||
do {
|
||||
pre = e;
|
||||
e = e.next;
|
||||
if (key == e.key) {
|
||||
pre.next = e.next;
|
||||
size--;
|
||||
if (headNode.next == null) use--;
|
||||
return;
|
||||
}
|
||||
} while (e.next != null);
|
||||
|
Loading…
Reference in New Issue
Block a user