Skip to content

Commit 55d567e

Browse files
author
jsquared21
committed
Decrease size when entry is removed MyHashMap.remove
1 parent 2dd4468 commit 55d567e

File tree

2 files changed

+1
-0
lines changed

2 files changed

+1
-0
lines changed
14 Bytes
Binary file not shown.

Exercise_27/Exercise_27_01/MyHashMap.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public void remove(K key) {
173173
// Remove the entry that matches the key
174174
if (table.get(index).getKey() == key) {
175175
table.remove(index);
176+
size--; // Decrease size
176177
}
177178
}
178179

0 commit comments

Comments
 (0)