@Override public boolean reverseAddAllTo(IntCollection c) { if (this.isEmpty()) return false; boolean changed = false; long[] tab = table; long entry; for (int i = tab.length - 1; i >= 0; i--) { if ((int) (entry = tab[i]) < FREE_BITS) { changed |= c.add((int) (entry >>> 32)); } } return changed; }
@Override public boolean test(int value) { return collection.contains(value); } });
public static boolean addAll(final IntCollection collection, Collection<? extends Integer> another) { if (collection == another) throw new IllegalArgumentException(); long maxPossibleSize = collection.sizeAsLong() + Containers.sizeAsLong(another); collection.ensureCapacity(maxPossibleSize); if (another instanceof IntCollection) { if (another instanceof InternalIntCollectionOps) { return ((InternalIntCollectionOps) another).reverseAddAllTo(collection); } else { class AddAll implements IntConsumer { boolean collectionChanged = false; @Override public void accept(int value) { collectionChanged |= collection.add(value); } } AddAll addAll = new AddAll(); ((IntCollection) another).forEach(addAll); return addAll.collectionChanged; } } else { boolean collectionChanged = false; for (Integer v : another) { collectionChanged |= collection.add(v.intValue()); } return collectionChanged; } }
public static boolean containsAll(final IntCollection collection, Collection<?> another) { if (collection == another) return true; if (another instanceof IntCollection) { IntCollection c2 = (IntCollection) another; if (collection instanceof IntSet && c2 instanceof IntSet && collection.size() < another.size()) { return false; } if (c2 instanceof InternalIntCollectionOps) { // noinspection unchecked return ((InternalIntCollectionOps) c2).allContainingIn(collection); } return c2.forEachWhile(new IntPredicate() { @Override public boolean test(int value) { return collection.contains(value); } }); } else { for (Object o : another) { if (!collection.contains(((Integer) o).intValue() )) return false; } return true; } }
private boolean removeAll(IntCollection c) { if (this == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] tab = table; long entry; for (int i = tab.length - 1; i >= 0; i--) { if ((int) (entry = tab[i]) < FREE_BITS) { if (c.contains((int) (entry >>> 32))) { incrementModCount(); mc++; U.putInt(tab, LONG_BASE + FLOAT_KEY_OFFSET + (((long) (i)) << LONG_SCALE_SHIFT), REMOVED_BITS); postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
private boolean removeAll(IntCollection c) { if (this == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] tab = table; long entry; for (int i = tab.length - 1; i >= 0; i--) { if ((int) (entry = tab[i]) < FREE_BITS) { if (c.contains((int) (entry >>> 32))) { incrementModCount(); mc++; U.putInt(tab, LONG_BASE + FLOAT_KEY_OFFSET + (((long) (i)) << LONG_SCALE_SHIFT), REMOVED_BITS); postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public static boolean containsAll(final IntCollection collection, Collection<?> another) { if (collection == another) return true; if (another instanceof IntCollection) { IntCollection c2 = (IntCollection) another; if (collection instanceof IntSet && c2 instanceof IntSet && collection.size() < another.size()) { return false; } if (c2 instanceof InternalIntCollectionOps) { // noinspection unchecked return ((InternalIntCollectionOps) c2).allContainingIn(collection); } return c2.forEachWhile(new IntPredicate() { @Override public boolean test(int value) { return collection.contains(value); } }); } else { for (Object o : another) { if (!collection.contains(((Integer) o).intValue() )) return false; } return true; } }
private boolean removeAll(IntCollection c) { if (this == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] < FREE_BITS) { if (c.contains(vals[i])) { incrementModCount(); mc++; keys[i] = REMOVED_BITS; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public boolean test(int value) { return collection.contains(value); } });
public boolean reverseAddAllTo(IntCollection c) { if (this.isEmpty()) return false; boolean changed = false; int free = freeValue; int[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) != free) { changed |= c.add(key); } } return changed; }
public static boolean addAll(final IntCollection collection, Collection<? extends Integer> another) { if (collection == another) throw new IllegalArgumentException(); long maxPossibleSize = collection.sizeAsLong() + Containers.sizeAsLong(another); collection.ensureCapacity(maxPossibleSize); if (another instanceof IntCollection) { if (another instanceof InternalIntCollectionOps) { return ((InternalIntCollectionOps) another).reverseAddAllTo(collection); } else { class AddAll implements IntConsumer { boolean collectionChanged = false; @Override public void accept(int value) { collectionChanged |= collection.add(value); } } AddAll addAll = new AddAll(); ((IntCollection) another).forEach(addAll); return addAll.collectionChanged; } } else { boolean collectionChanged = false; for (Integer v : another) { collectionChanged |= collection.add(v.intValue()); } return collectionChanged; } }
private boolean removeAll(IntCollection c) { if (this == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] < FREE_BITS) { if (c.contains(vals[i])) { incrementModCount(); mc++; keys[i] = REMOVED_BITS; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public boolean allContainingIn(IntCollection c) { if (this.isEmpty()) return true; boolean containsAll = true; int free = freeValue; int[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) != free) { if (!c.contains(key)) { containsAll = false; break; } } } return containsAll; }
public boolean reverseAddAllTo(IntCollection c) { if (this.isEmpty()) return false; boolean changed = false; int free = freeValue; int[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) != free) { changed |= c.add(key); } } return changed; }
boolean removeAll(@Nonnull HashIntSet thisC, @Nonnull IntCollection c) { if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int key; if ((key = U.getInt(tab, base + off)) != free) { if (c.contains(key)) { incrementModCount(); mc++; int key; if ((key = U.getInt(tab, base + off)) != free && key != removed) { if (c.contains(key)) { incrementModCount(); mc++;
@Override public boolean allContainingIn(IntCollection c) { if (this.isEmpty()) return true; boolean containsAll = true; long[] tab = table; long entry; for (int i = tab.length - 1; i >= 0; i--) { if ((int) (entry = tab[i]) < FREE_BITS) { if (!c.contains((int) (entry >>> 32))) { containsAll = false; break; } } } return containsAll; }
public boolean reverseAddAllTo(IntCollection c) { if (this.isEmpty()) return false; boolean changed = false; int free = freeValue; int[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) != free) { changed |= c.add(key); } } return changed; }
if (this.isEmpty()) return false; if (c.isEmpty()) { clear(); return true; int key; if ((key = U.getInt(tab, base + off)) != free) { if (!c.contains(key)) { incrementModCount(); mc++; int key; if ((key = U.getInt(tab, base + off)) != free && key != removed) { if (!c.contains(key)) { incrementModCount(); mc++;
public boolean allContainingIn(IntCollection c) { if (this.isEmpty()) return true; boolean containsAll = true; int free = freeValue; int[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) != free) { if (!c.contains(key)) { containsAll = false; break; } } } return containsAll; }
@Override public boolean reverseAddAllTo(IntCollection c) { if (this.isEmpty()) return false; boolean changed = false; long[] keys = set; int[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { if (keys[i] < FREE_BITS) { changed |= c.add(vals[i]); } } return changed; }