Skip to content

Commit

Permalink
should remove node in list and hash table both
Browse files Browse the repository at this point in the history
删除一个缓存元素时,除了删除链表中的节点,也要删除散列表中的节点。
  • Loading branch information
damianzhenxiaozhi authored Sep 27, 2019
1 parent 63e2dd2 commit 15d1990
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion java/20_hashtable/LRUBaseHashTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public void remove(K key) {
}
removeNode(node);
length--;
table.remove(node.key);
}

private void printAll() {
Expand All @@ -192,4 +193,4 @@ private void printAll() {
}
System.out.println();
}
}
}

0 comments on commit 15d1990

Please sign in to comment.