Reset size to 0
when clearing table
This commit is contained in:
parent
13991b6bd2
commit
1d0e670597
1 changed files with 130 additions and 129 deletions
|
@ -31,6 +31,7 @@ public class MyHashtable<K, V> implements Map<K, V> {
|
|||
|
||||
// Removes all mappings from this map (optional operation).
|
||||
public void clear() {
|
||||
size = 0;
|
||||
keys = (K[]) new Object[capacity];
|
||||
values = (V[]) new Object[capacity];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue