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