diff --git a/java/18_hashtable/HashTable.java b/java/18_hashtable/HashTable.java index 9db7c7f..c2df579 100644 --- a/java/18_hashtable/HashTable.java +++ b/java/18_hashtable/HashTable.java @@ -142,12 +142,14 @@ public class HashTable { } Entry pre; + Entry 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);