public boolean allContainingIn(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return allContainingIn((InternalDoubleCollectionOps) c); if (this.isEmpty()) return true; boolean containsAll = true; 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))) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
public void forEach(Consumer<? super Double> action) { if (action == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { action.accept(Double.longBitsToDouble(key)); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Nonnull public double[] toDoubleArray() { int size = size(); double[] result = new double[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { result[resultIndex++] = Double.longBitsToDouble(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (this.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) { changed |= c.add(Double.longBitsToDouble(key)); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public boolean removeIf(Predicate<? super Double> filter) { if (filter == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; int capacityMask = keys.length - 1; if ((key = keys[i]) < FREE_BITS) { if (filter.test(Double.longBitsToDouble(key))) { incrementModCount(); mc++; closeDeletion: postRemoveHook(); } else { keys[i] = REMOVED_BITS; closeDelayedRemoved(firstDelayedRemoved); if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
long curKey; if ((curKey = this.curKey) != FREE_BITS) { if (expectedModCount++ == modCount()) { this.curKey = FREE_BITS; int index = this.index; if (keys == set) { int capacityMask = this.capacityMask; incrementModCount(); int indexToRemove = index; int indexToShift = indexToRemove; postRemoveHook(); } else { justRemove(curKey);
public boolean reverseRemoveAllFrom(DoubleSet s) { if (s instanceof InternalDoubleCollectionOps) return reverseRemoveAllFrom((InternalDoubleCollectionOps) s); if (this.isEmpty() || s.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) { changed |= s.removeDouble(Double.longBitsToDouble(key)); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public String setToString() { if (this.isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { sb.append(' ').append(Double.longBitsToDouble(key)).append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); sb.setCharAt(0, '['); sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); }
public int setHashCode() { int hashCode = 0; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { hashCode += ((int) (key ^ (key >>> 32))); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override public void clear() { int mc = modCount() + 1; super.clear(); if (mc != modCount()) throw new ConcurrentModificationException(); } }
boolean retainAll(@Nonnull HashDoubleSet thisC, @Nonnull Collection<?> c) { if (c instanceof DoubleCollection) return retainAll(thisC, (DoubleCollection) c); if (thisC == (Object) c) throw new IllegalArgumentException(); if (this.isEmpty()) return false; if (c.isEmpty()) { clear(); return true; int mc = modCount(); long[] keys = set; int capacityMask = keys.length - 1; if ((key = keys[i]) < FREE_BITS) { if (!c.contains(Double.longBitsToDouble(key))) { incrementModCount(); mc++; closeDeletion: postRemoveHook(); } else { keys[i] = REMOVED_BITS; closeDelayedRemoved(firstDelayedRemoved); if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed;
int index; if ((index = this.index) >= 0) { if (expectedModCount++ == modCount()) { this.index = -1; long[] keys = this.keys; if (keys == set) { int capacityMask = this.capacityMask; incrementModCount(); int indexToRemove = index; int indexToShift = indexToRemove; postRemoveHook(); } else { justRemove(keys[index]);
boolean reverseAddAllTo(InternalDoubleCollectionOps c) { if (this.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) { changed |= c.add(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { result[resultIndex++] = Double.longBitsToDouble(key); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
public boolean reverseRemoveAllFrom(DoubleSet s) { if (s instanceof InternalDoubleCollectionOps) return reverseRemoveAllFrom((InternalDoubleCollectionOps) s); if (this.isEmpty() || s.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) { changed |= s.removeDouble(Double.longBitsToDouble(key)); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (this.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) { changed |= c.add(Double.longBitsToDouble(key)); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
public String setToString() { if (this.isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { sb.append(' ').append(Double.longBitsToDouble(key)).append(','); if (++elementCount == 8) { int expectedLength = sb.length() * (size() / 8); sb.ensureCapacity(expectedLength + (expectedLength / 2)); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); sb.setCharAt(0, '['); sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); }
public int setHashCode() { int hashCode = 0; int mc = modCount(); long[] keys = set; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { hashCode += ((int) (key ^ (key >>> 32))); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override public void clear() { int mc = modCount() + 1; super.clear(); if (mc != modCount()) throw new ConcurrentModificationException(); } }