public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (this.isEmpty()) return false; boolean changed = false; long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { changed |= c.add(Double.longBitsToDouble(key)); } } return changed; }
@Override public boolean test(double value) { return collection.contains(value); } });
public static boolean addAll(final DoubleCollection collection, Collection<? extends Double> another) { if (collection == another) throw new IllegalArgumentException(); long maxPossibleSize = collection.sizeAsLong() + Containers.sizeAsLong(another); collection.ensureCapacity(maxPossibleSize); if (another instanceof DoubleCollection) { if (another instanceof InternalDoubleCollectionOps) { return ((InternalDoubleCollectionOps) another).reverseAddAllTo(collection); } else { class AddAll implements DoubleConsumer { boolean collectionChanged = false; @Override public void accept(double value) { collectionChanged |= collection.add(value); } } AddAll addAll = new AddAll(); ((DoubleCollection) another).forEach(addAll); return addAll.collectionChanged; } } else { boolean collectionChanged = false; for (Double v : another) { collectionChanged |= collection.add(v.doubleValue()); } return collectionChanged; } }
public static boolean containsAll(final DoubleCollection collection, Collection<?> another) { if (collection == another) return true; if (another instanceof DoubleCollection) { DoubleCollection c2 = (DoubleCollection) another; if (collection instanceof DoubleSet && c2 instanceof DoubleSet && collection.size() < another.size()) { return false; } if (c2 instanceof InternalDoubleCollectionOps) { // noinspection unchecked return ((InternalDoubleCollectionOps) c2).allContainingIn(collection); } return c2.forEachWhile(new DoublePredicate() { @Override public boolean test(double value) { return collection.contains(value); } }); } else { for (Object o : another) { if (!collection.contains(((Double) o).doubleValue() )) return false; } return true; } }
boolean removeAll(@Nonnull HashDoubleSet thisC, @Nonnull DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return removeAll(thisC, (InternalDoubleCollectionOps) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { if (c.contains(Double.longBitsToDouble(key))) { incrementModCount(); mc++; tab[i] = REMOVED_BITS; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
boolean removeAll(@Nonnull HashDoubleSet thisC, @Nonnull DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return removeAll(thisC, (InternalDoubleCollectionOps) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { if (c.contains(Double.longBitsToDouble(key))) { incrementModCount(); mc++; tab[i] = REMOVED_BITS; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public static boolean containsAll(final DoubleCollection collection, Collection<?> another) { if (collection == another) return true; if (another instanceof DoubleCollection) { DoubleCollection c2 = (DoubleCollection) another; if (collection instanceof DoubleSet && c2 instanceof DoubleSet && collection.size() < another.size()) { return false; } if (c2 instanceof InternalDoubleCollectionOps) { // noinspection unchecked return ((InternalDoubleCollectionOps) c2).allContainingIn(collection); } return c2.forEachWhile(new DoublePredicate() { @Override public boolean test(double value) { return collection.contains(value); } }); } else { for (Object o : another) { if (!collection.contains(((Double) o).doubleValue() )) return false; } return true; } }
@Override boolean removeAll(@Nonnull HashDoubleSet thisC, @Nonnull DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return removeAll(thisC, (InternalDoubleCollectionOps) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { if (c.contains(Double.longBitsToDouble(key))) { incrementModCount(); mc++; keys[i] = REMOVED_BITS; vals[i] = null; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public boolean test(double value) { return collection.contains(value); } });
@Override public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (this.isEmpty()) return false; boolean changed = false; long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { changed |= c.add(Double.longBitsToDouble(tab[i + 1])); } } return changed; }
public static boolean addAll(final DoubleCollection collection, Collection<? extends Double> another) { if (collection == another) throw new IllegalArgumentException(); long maxPossibleSize = collection.sizeAsLong() + Containers.sizeAsLong(another); collection.ensureCapacity(maxPossibleSize); if (another instanceof DoubleCollection) { if (another instanceof InternalDoubleCollectionOps) { return ((InternalDoubleCollectionOps) another).reverseAddAllTo(collection); } else { class AddAll implements DoubleConsumer { boolean collectionChanged = false; @Override public void accept(double value) { collectionChanged |= collection.add(value); } } AddAll addAll = new AddAll(); ((DoubleCollection) another).forEach(addAll); return addAll.collectionChanged; } } else { boolean collectionChanged = false; for (Double v : another) { collectionChanged |= collection.add(v.doubleValue()); } return collectionChanged; } }
boolean removeAll(@Nonnull HashDoubleSet thisC, @Nonnull DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return removeAll(thisC, (InternalDoubleCollectionOps) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { if (c.contains(Double.longBitsToDouble(key))) { incrementModCount(); mc++; keys[i] = REMOVED_BITS; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public boolean allContainingIn(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return allContainingIn((InternalDoubleCollectionOps) c); if (this.isEmpty()) return true; boolean containsAll = true; long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { if (!c.contains(Double.longBitsToDouble(key))) { containsAll = false; break; } } } return containsAll; }
public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (this.isEmpty()) return false; boolean changed = false; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { changed |= c.add(Double.longBitsToDouble(key)); } } return changed; }
boolean removeAll(@Nonnull HashDoubleSet thisC, @Nonnull DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return removeAll(thisC, (InternalDoubleCollectionOps) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { if (c.contains(Double.longBitsToDouble(key))) { incrementModCount(); mc++; keys[i] = REMOVED_BITS; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public boolean allContainingIn(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return allContainingIn((InternalDoubleCollectionOps) c); if (this.isEmpty()) return true; boolean containsAll = true; long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { if (!c.contains(Double.longBitsToDouble(tab[i + 1]))) { containsAll = false; break; } } } return containsAll; }
public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (this.isEmpty()) return false; boolean changed = false; long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { changed |= c.add(Double.longBitsToDouble(key)); } } return changed; }
private boolean removeAll(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return removeAll((InternalDoubleCollectionOps) c); if (this == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty() || c.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { if (c.contains(Double.longBitsToDouble(tab[i + 1]))) { incrementModCount(); mc++; tab[i] = REMOVED_BITS; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public boolean allContainingIn(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return allContainingIn((InternalDoubleCollectionOps) c); if (this.isEmpty()) return true; boolean containsAll = true; long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { if (!c.contains(Double.longBitsToDouble(key))) { containsAll = false; break; } } } return containsAll; }
public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (this.isEmpty()) return false; boolean changed = false; long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { changed |= c.add(Double.longBitsToDouble(key)); } } return changed; }