@Override public DoubleIterator iterator() { return DoubleIterators.asDoubleIterator(map.values().iterator()); }
public static boolean any(final DoubleIterator iterator, final java.util.function.DoublePredicate predicate) { return indexOf(iterator, predicate) != -1; } public static boolean all(final DoubleIterator iterator, final java.util.function.DoublePredicate predicate) {
@Override public DoubleListIterator listIterator() { return DoubleIterators.singleton(element); } @Override
/** * Creates a new array list and fills it with a given collection. * * @param c * a collection that will be used to fill the array list. */ public DoubleArrayList(final Collection<? extends Double> c) { this(c.size()); size = DoubleIterators.unwrap(DoubleIterators.asDoubleIterator(c.iterator()), a); } /**
@Override public DoubleListIterator listIterator() { return DoubleIterators.unmodifiable(list.listIterator()); } @Override
/** * Unwraps an iterator, returning an array. * * <p> * This method iterates over the given type-specific iterator and returns an * array containing the elements returned by the iterator. * * @param i * a type-specific iterator. * @return an array containing the elements returned by the iterator. */ public static double[] unwrap(final DoubleIterator i) { return unwrap(i, Integer.MAX_VALUE); } /**
/** * Pours an iterator, returning a type-specific list. * * <p> * This method iterates over the given type-specific iterator and returns a list * containing the returned elements. Iteration on the returned list is * guaranteed to produce the elements in the same order in which they appeared * in the iterator. * * @param i * a type-specific iterator. * @return a type-specific list containing the returned elements. */ public static DoubleList pour(final DoubleIterator i) { return pour(i, Integer.MAX_VALUE); } private static class IteratorWrapper implements DoubleIterator {
/** * Concatenates all iterators contained in an array. * * <p> * This method returns an iterator that will enumerate in order the elements * returned by all iterators contained in the given array. * * @param a * an array of iterators. * @return an iterator obtained by concatenation. */ public static DoubleIterator concat(final DoubleIterator a[]) { return concat(a, 0, a.length); } /**
@Override public DoubleListIterator listIterator(final int i) { return DoubleIterators.unmodifiable(list.listIterator(i)); } @Override
/** * Unwraps an iterator into an array. * * <p> * This method iterates over the given type-specific iterator and stores the * elements returned in the given array. The iteration will stop when the * iterator has no more elements or when the end of the array has been reached. * * @param i * a type-specific iterator. * @param array * an array to contain the output of the iterator. * @return the number of elements unwrapped. */ public static int unwrap(final DoubleIterator i, final double array[]) { return unwrap(i, array, 0, array.length); } /**
/** * Pours an iterator into a type-specific collection. * * <p> * This method iterates over the given type-specific iterator and adds the * returned elements to the given collection. * * @param i * a type-specific iterator. * @param s * a type-specific collection. * @return the number of elements poured. Note that this is the number of * elements returned by the iterator, which is not necessarily the * number of elements that have been added to the collection (because of * duplicates). */ public static int pour(final DoubleIterator i, final DoubleCollection s) { return pour(i, s, Integer.MAX_VALUE); } /**
/** * Creates a new tree set using elements provided by an iterator. * * @param i * an iterator whose elements will fill the set. */ public DoubleAVLTreeSet(final Iterator<?> i) { this(DoubleIterators.asDoubleIterator(i)); } /**
@Override public DoubleBidirectionalIterator iterator() { return DoubleIterators.unmodifiable(sortedSet.iterator()); } @Override
/** * Creates a new array list and fills it with a given type-specific collection. * * @param c * a type-specific collection that will be used to fill the array * list. */ public DoubleArrayList(final DoubleCollection c) { this(c.size()); size = DoubleIterators.unwrap(c.iterator(), a); } /**
/** * Pours an iterator, returning a type-specific list, with a limit on the number * of elements. * * <p> * This method iterates over the given type-specific iterator and returns a * type-specific list containing the returned elements (up to {@code max}). * Iteration on the returned list is guaranteed to produce the elements in the * same order in which they appeared in the iterator. * * * @param i * a type-specific iterator. * @param max * the maximum number of elements to be poured. * @return a type-specific list containing the returned elements, up to * {@code max}. */ public static DoubleList pour(final DoubleIterator i, int max) { final DoubleArrayList l = new DoubleArrayList(); pour(i, l, max); l.trim(); return l; } /**
@Override public DoubleListIterator iterator() { return DoubleIterators.singleton(element); } @Override
/** * Creates a new hash big set using elements provided by an iterator. * * @param i * an iterator whose elements will fill the new hash big set. * @param f * the load factor. */ public DoubleOpenHashBigSet(final Iterator<?> i, final float f) { this(DoubleIterators.asDoubleIterator(i), f); } /**
@Override public DoubleBidirectionalIterator iterator(final double from) { return DoubleIterators.unmodifiable(sortedSet.iterator(from)); } @Override
@Override public double[] toArray(double a[]) { if (a == null || a.length < size()) a = new double[size()]; DoubleIterators.unwrap(iterator(), a); return a; } @Override
/** * Creates a new hash set using elements provided by an iterator. * * @param i * an iterator whose elements will fill the set. * @param f * the load factor. */ public DoubleLinkedOpenHashSet(final Iterator<?> i, final float f) { this(DoubleIterators.asDoubleIterator(i), f); } /**