public IntHashSet(final int capacity, final int missingValue) { checkTrue(capacity <= MAX_CAPACITY, "Maximum capacity is 2^29"); this.capacity = capacity; size = 0; this.missingValue = missingValue; final int arraySize = nextPowerOfTwo(2 * capacity); mask = arraySize - 1; values = new int[arraySize]; Arrays.fill(values, missingValue); // NB: references values in the constructor, so must be assigned after values iterator = new IntIterator(missingValue, values); }
public IntHashSet(final int capacity, final int missingValue) { checkTrue(capacity <= MAX_CAPACITY, "Maximum capacity is 2^29"); this.capacity = capacity; size = 0; this.missingValue = missingValue; final int arraySize = nextPowerOfTwo(2 * capacity); mask = arraySize - 1; values = new int[arraySize]; Arrays.fill(values, missingValue); // NB: references values in the constructor, so must be assigned after values iterator = new IntIterator(missingValue, values); }