@Override @Nonnull public DoubleCollection values() { return new ValueView(); }
@Override public String toString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { sb.append(' ').append(Double.longBitsToDouble(tab[i + 1])).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(); }
@Override @SuppressWarnings("unchecked") @Nonnull public <T> T[] toArray(@Nonnull T[] a) { int size = size(); if (a.length < size) { Class<?> elementType = a.getClass().getComponentType(); a = (T[]) java.lang.reflect.Array.newInstance(elementType, size); } if (size == 0) { if (a.length > 0) a[0] = null; return a; } int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { a[resultIndex++] = (T) Double.valueOf(Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = null; return a; }
@Override @SuppressWarnings("unchecked") @Nonnull public <T> T[] toArray(@Nonnull T[] a) { int size = size(); if (a.length < size) { Class<?> elementType = a.getClass().getComponentType(); a = (T[]) java.lang.reflect.Array.newInstance(elementType, size); } if (size == 0) { if (a.length > 0) a[0] = null; return a; } int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { a[resultIndex++] = (T) Double.valueOf(Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = null; return a; }
@Override public double[] toArray(double[] a) { int size = size(); if (a.length < size) a = new double[size]; if (size == 0) { if (a.length > 0) a[0] = 0.0; return a; } int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { a[resultIndex++] = Double.longBitsToDouble(tab[i + 1]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = 0.0; return a; }
@Override public String toString() { if (isEmpty()) return "[]"; StringBuilder sb = new StringBuilder(); int elementCount = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { sb.append(' ').append(Double.longBitsToDouble(tab[i + 1])).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(); }
@Override public boolean forEachWhile(DoublePredicate predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { if (!predicate.test(Double.longBitsToDouble(tab[i + 1]))) { terminated = true; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return !terminated; }
@Override public boolean forEachWhile(DoublePredicate predicate) { if (predicate == null) throw new java.lang.NullPointerException(); if (isEmpty()) return true; boolean terminated = false; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { if (!predicate.test(Double.longBitsToDouble(tab[i + 1]))) { terminated = true; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return !terminated; }
@Override public double[] toArray(double[] a) { int size = size(); if (a.length < size) a = new double[size]; if (size == 0) { if (a.length > 0) a[0] = 0.0; return a; } int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { a[resultIndex++] = Double.longBitsToDouble(tab[i + 1]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); if (a.length > resultIndex) a[resultIndex] = 0.0; return a; }
@Override @Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { result[resultIndex++] = Double.longBitsToDouble(tab[i + 1]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
@Override @Nonnull public Object[] toArray() { int size = size(); Object[] result = new Object[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { result[resultIndex++] = Double.longBitsToDouble(tab[i + 1]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
@Override public boolean allContainingIn(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return allContainingIn((InternalDoubleCollectionOps) c); if (isEmpty()) return true; boolean containsAll = true; 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]))) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
@Override public double[] toDoubleArray() { int size = size(); double[] result = new double[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { result[resultIndex++] = Double.longBitsToDouble(tab[i + 1]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
private boolean allContainingIn(InternalDoubleCollectionOps c) { if (isEmpty()) return true; boolean containsAll = true; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { if (!c.contains(tab[i + 1])) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
@Override public boolean reverseRemoveAllFrom(DoubleSet s) { if (s instanceof InternalDoubleCollectionOps) return reverseRemoveAllFrom((InternalDoubleCollectionOps) s); if (isEmpty() || s.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) { changed |= s.removeDouble(Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public boolean reverseRemoveAllFrom(DoubleSet s) { if (s instanceof InternalDoubleCollectionOps) return reverseRemoveAllFrom((InternalDoubleCollectionOps) s); if (isEmpty() || s.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) { changed |= s.removeDouble(Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public double[] toDoubleArray() { int size = size(); double[] result = new double[size]; if (size == 0) return result; int resultIndex = 0; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { if (tab[i] < FREE_BITS) { result[resultIndex++] = Double.longBitsToDouble(tab[i + 1]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return result; }
@Override public boolean allContainingIn(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return allContainingIn((InternalDoubleCollectionOps) c); if (isEmpty()) return true; boolean containsAll = true; 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]))) { containsAll = false; break; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return containsAll; }
@Override public boolean reverseAddAllTo(DoubleCollection c) { if (c instanceof InternalDoubleCollectionOps) return reverseAddAllTo((InternalDoubleCollectionOps) c); if (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) { changed |= c.add(Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
private boolean reverseRemoveAllFrom(InternalDoubleCollectionOps s) { if (isEmpty() || s.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) { changed |= s.removeDouble(tab[i + 1]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }