@Override default DoubleStream mapToDouble(ToDoubleFunction<? super T> fn){ Spliterator<T> split = this.spliterator(); return (split instanceof Spliterator.OfDouble) ? StreamSupport.doubleStream((Spliterator.OfDouble)split,false) : StreamSupport.stream(split,false).mapToDouble(fn); }
/** * Generates a DoubleStream that traverses double-valued keys of a scala.collection.mutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamKeys(scala.collection.mutable.HashMap<Double, ?> coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.doubleStream(new StepsDoubleHashTableKey(tbl, 0, tbl.length), false); }
/** * Generates a DoubleStream that traverses a scala.collection.immutable.Vector of Doubles. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The Vector to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.immutable.Vector<Double> coll) { scala.collection.immutable.Vector erased = (scala.collection.immutable.Vector)coll; return StreamSupport.doubleStream(new StepsDoubleVector(erased, 0, coll.length()), false); }
/** * Generates a DoubleStream that traverses double-valued values of a scala.collection.mutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamValues(scala.collection.mutable.HashMap<? super Object, Double> coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.doubleStream(new StepsDoubleDefaultHashTableValue(tbl, 0, tbl.length), false); }
/** * Generates a DoubleStream that traverses double-valued values of a scala.collection.mutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamValues(scala.collection.mutable.HashMap<? super Object, Double> coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.doubleStream(new StepsDoubleDefaultHashTableValue(tbl, 0, tbl.length), false); }
/** * Generates a DoubleStream that traverses double-valued keys of a scala.collection.immutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamKeys(scala.collection.immutable.HashMap<Double, ? super Object> coll) { return StreamSupport.doubleStream(new StepsDoubleImmHashMapKey(coll, 0, coll.size()), false); }
/** * Generates a DoubleStream that traverses double-valued keys of a scala.collection.immutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamKeys(scala.collection.immutable.HashMap<Double, ? super Object> coll) { return StreamSupport.doubleStream(new StepsDoubleImmHashMapKey(coll, 0, coll.size()), false); }
/** * Generates a DoubleStream that traverses double-valued keys of a scala.collection.mutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamKeys(scala.collection.mutable.HashMap<Double, ?> coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.doubleStream(new StepsDoubleHashTableKey(tbl, 0, tbl.length), false); }
/** * Generates a DoubleStream that traverses double-valued keys of a scala.collection.immutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamKeys(scala.collection.immutable.HashMap<Double, ? super Object> coll) { return StreamSupport.doubleStream(new StepsDoubleImmHashMapKey(coll, 0, coll.size()), false); }
/** * Generates a DoubleStream that traverses double-valued values of a scala.collection.immutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamValues(scala.collection.immutable.HashMap<? super Object, Double> coll) { return StreamSupport.doubleStream(new StepsDoubleImmHashMapValue(coll, 0, coll.size()), false); }
/** * Generates a DoubleStream that traverses a scala.collection.mutable.HashSet of Doubles. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashSet to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.mutable.HashSet<Double> coll) { Object[] tbl = CollectionInternals.getTable(coll); return StreamSupport.doubleStream(new StepsDoubleFlatHashTable(tbl, 0, tbl.length), false); }
/** * Generates a DoubleStream that traverses the double-valued keys of a scala.collection.Map. * <p> * Only sequential operations will be efficient. * For efficient parallel operation, use the doubleStreamAccumulatedKeys method instead, but * note that this creates a new collection containing the Map's keys. * * @param coll The Map to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamKeys(scala.collection.Map<Double, ?> coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.keysIterator(); return StreamSupport.doubleStream(new StepsDoubleIterator(iter), false); }
/** * Generates a DoubleStream that traverses an IndexedSeq of Doubles. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The IndexedSeq to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.IndexedSeq<Double> coll) { return StreamSupport.doubleStream(new StepsDoubleIndexedSeq(coll, 0, coll.length()), false); }
/** * Generates a DoubleStream that traverses double-valued values of a scala.collection.immutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamValues(scala.collection.immutable.HashMap<? super Object, Double> coll) { return StreamSupport.doubleStream(new StepsDoubleImmHashMapValue(coll, 0, coll.size()), false); }
/** * Generates a DoubleStream that traverses a scala.collection.mutable.HashSet of Doubles. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashSet to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.mutable.HashSet<Double> coll) { Object[] tbl = CollectionInternals.getTable(coll); return StreamSupport.doubleStream(new StepsDoubleFlatHashTable(tbl, 0, tbl.length), false); }
/** * Generates a DoubleStream that traverses a scala.collection.immutable.Vector of Doubles. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The Vector to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.immutable.Vector<Double> coll) { scala.collection.immutable.Vector erased = (scala.collection.immutable.Vector)coll; return StreamSupport.doubleStream(new StepsDoubleVector(erased, 0, coll.length()), false); }
/** * Generates a DoubleStream that traverses double-valued values of a scala.collection.mutable.HashMap. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamValues(scala.collection.mutable.HashMap<? super Object, Double> coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.doubleStream(new StepsDoubleDefaultHashTableValue(tbl, 0, tbl.length), false); }
/** * Generates a DoubleStream that traverses a scala.collection.immutable.HashSet of Doubles. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashSet to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.immutable.HashSet<Double> coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.doubleStream(new StepsDoubleImmHashSet(iter, coll.size()), false); }
/** * Generates a DoubleStream that traverses a scala.collection.immutable.HashSet of Doubles. * <p> * Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashSet to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.immutable.HashSet<Double> coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.doubleStream(new StepsDoubleImmHashSet(iter, coll.size()), false); }
public void testDoubleToArray() { Cache<Double, String> cache = getCache(0); int range = 10; // First populate the cache with a bunch of values DoubleStream.iterate(0.0, d -> d + .5).limit(10).boxed().forEach(i -> cache.put(i, i + "-value")); assertEquals(range, cache.size()); CacheSet<Map.Entry<Double, String>> entrySet = cache.entrySet(); double[] array = createStream(entrySet).mapToDouble(toDouble).toArray(); assertEquals(cache.size(), array.length); Spliterator.OfDouble spliterator = Spliterators.spliterator(array, Spliterator.DISTINCT); StreamSupport.doubleStream(spliterator, true).forEach(e -> assertTrue(cache.containsKey(e))); }