/** * An alias for the (preferred) {@link #removeAll}. */ public boolean remove(int key) { if (((key) == 0)) { boolean hadEmptyKey = hasEmptyKey; hasEmptyKey = false; return hadEmptyKey; } else { final int [] keys = this.keys; final int mask = this.mask; int slot = hashKey(key) & mask; int existing; while (!((existing = keys[slot]) == 0)) { if (((existing) == ( key))) { shiftConflictingKeys(slot); return true; } slot = (slot + 1) & mask; } return false; } }
/** * {@inheritDoc} */ @Override public int removeAll(IntPredicate predicate) { int before = size(); if (hasEmptyKey) { if (predicate.apply(0)) { hasEmptyKey = false; } } final int[] keys = this.keys; for (int slot = 0, max = this.mask; slot <= max;) { int existing; if (!((existing = keys[slot]) == 0)) { if (predicate.apply(existing)) { shiftConflictingKeys(slot); continue; // Repeat the check for the same slot i (shifted). } } slot++; } return before - size(); }
/** * An alias for the (preferred) {@link #removeAll}. */ public boolean remove(int key) { if (((key) == 0)) { boolean hadEmptyKey = hasEmptyKey; hasEmptyKey = false; return hadEmptyKey; } else { final int [] keys = this.keys; final int mask = this.mask; int slot = hashKey(key) & mask; int existing; while (!((existing = keys[slot]) == 0)) { if (((existing) == ( key))) { shiftConflictingKeys(slot); return true; } slot = (slot + 1) & mask; } return false; } }
/** * {@inheritDoc} */ @Override public int removeAll(IntPredicate predicate) { int before = size(); if (hasEmptyKey) { if (predicate.apply(0)) { hasEmptyKey = false; } } final int[] keys = this.keys; for (int slot = 0, max = this.mask; slot <= max;) { int existing; if (!((existing = keys[slot]) == 0)) { if (predicate.apply(existing)) { shiftConflictingKeys(slot); continue; // Repeat the check for the same slot i (shifted). } } slot++; } return before - size(); }