public void remove() { if (isPositionValid) { if (0 == remaining && containsMissingValue) { containsMissingValue = false; } else { final int[] values = IntHashSet.this.values; @DoNotSub final int position = position(values); values[position] = MISSING_VALUE; --sizeOfArrayValues; compactChain(position); } isPositionValid = false; } else { throw new IllegalStateException(); } }
/** * An int specialised version of {this#remove(Object)}. * * @param value the value to remove * @return true if the value was present, false otherwise */ public boolean remove(final int value) { if (value == MISSING_VALUE) { final boolean previousContainsMissingValue = this.containsMissingValue; containsMissingValue = false; return previousContainsMissingValue; } final int[] values = this.values; @DoNotSub final int mask = values.length - 1; @DoNotSub int index = Hashing.hash(value, mask); while (values[index] != MISSING_VALUE) { if (values[index] == value) { values[index] = MISSING_VALUE; compactChain(index); sizeOfArrayValues--; return true; } index = next(index, mask); } return false; }
public void remove() { if (isPositionValid) { @DoNotSub final int position = position(); values[position] = missingValue; --size; compactChain(position); isPositionValid = false; } else { throw new IllegalStateException(); } } }
public void remove() { if (isPositionValid) { if (0 == remaining && containsMissingValue) { containsMissingValue = false; } else { final int[] values = IntHashSet.this.values; @DoNotSub final int position = position(values); values[position] = MISSING_VALUE; --sizeOfArrayValues; compactChain(position); } isPositionValid = false; } else { throw new IllegalStateException(); } }
/** * An int specialised version of {this#remove(Object)}. * * @param value the value to remove * @return true if the value was present, false otherwise */ public boolean remove(final int value) { final int[] values = this.values; @DoNotSub final int mask = values.length - 1; @DoNotSub int index = Hashing.hash(value, mask); while (values[index] != missingValue) { if (values[index] == value) { values[index] = missingValue; compactChain(index); size--; return true; } index = next(index, mask); } return false; }
/** * An int specialised version of {this#remove(Object)}. * * @param value the value to remove * @return true if the value was present, false otherwise */ public boolean remove(final int value) { if (value == MISSING_VALUE) { final boolean previousContainsMissingValue = this.containsMissingValue; containsMissingValue = false; return previousContainsMissingValue; } final int[] values = this.values; @DoNotSub final int mask = values.length - 1; @DoNotSub int index = Hashing.hash(value, mask); while (values[index] != MISSING_VALUE) { if (values[index] == value) { values[index] = MISSING_VALUE; compactChain(index); sizeOfArrayValues--; return true; } index = next(index, mask); } return false; }