This commit is contained in:
parrt 2016-11-19 16:13:50 -08:00
parent 34f0c66a89
commit 883e013cc6
1 changed files with 2 additions and 1 deletions

View File

@ -50,7 +50,7 @@ public class Array2DHashSet<T> implements Set<T> {
/** How many elements in set */
protected int n = 0;
protected int threshold = (int)(INITAL_CAPACITY * LOAD_FACTOR); // when to expand
protected int threshold = (int)Math.floor(INITAL_CAPACITY * LOAD_FACTOR); // when to expand
protected int currentPrime = 1; // jump by 4 primes each expand or whatever
protected int initialBucketCapacity = INITAL_BUCKET_CAPACITY;
@ -407,6 +407,7 @@ public class Array2DHashSet<T> implements Set<T> {
public void clear() {
buckets = createBuckets(INITAL_CAPACITY);
n = 0;
threshold = (int)Math.floor(INITAL_CAPACITY * LOAD_FACTOR);
}
@Override