All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.compat.java8.ScalaStreamSupport Maven / Gradle / Ivy

The newest version!
package scala.compat.java8;

import scala.compat.java8.converterImpl.*;
import scala.compat.java8.collectionImpl.*;
import java.util.stream.*;
import scala.compat.java8.runtime.CollectionInternals;

/**
 * This class contains static utility methods for creating Java Streams from Scala Collections, similar
 * to the methods in {@code java.util.stream.StreamSupport} for other Java types. It is intended for
 * use from Java code. In Scala code, you can use the extension methods provided by
 * {@code scala.compat.java8.StreamConverters} instead.
 *
 * Streams created from immutable Scala collections are also immutable. Mutable collections should
 * not be modified concurrently. There are no guarantees for success or failure modes of existing
 * streams in case of concurrent modifications.
 */
public class ScalaStreamSupport {
    /////////////////////
    // Generic Streams //
    /////////////////////

    /** 
     * Generates a Stream that traverses an IndexedSeq.
     * 

* Both sequential and parallel operations will be efficient. * * @param coll The IndexedSeq to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream stream(scala.collection.IndexedSeq coll) { return StreamSupport.stream(new StepsAnyIndexedSeq(coll, 0, coll.length()), false); } /** * Generates a Stream that traverses the keys of a scala.collection.immutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamKeys(scala.collection.immutable.HashMap coll) { return StreamSupport.stream(new StepsAnyImmHashMapKey(coll, 0, coll.size()), false); } /** * Generates a Stream that traverses the values of a scala.collection.immutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamValues(scala.collection.immutable.HashMap coll) { return StreamSupport.stream(new StepsAnyImmHashMapValue(coll, 0, coll.size()), false); } /** * Generates a Stream that traverses the key-value pairs of a scala.collection.immutable.HashMap. * The key-value pairs are presented as instances of scala.Tuple2. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream< scala.Tuple2 > stream(scala.collection.immutable.HashMap coll) { return StreamSupport.stream(new StepsAnyImmHashMap(coll, 0, coll.size()), false); } /** * Generates a Stream that traverses a scala.collection.immutable.HashSet. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashSet to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream stream(scala.collection.immutable.HashSet coll) { return StreamSupport.stream(new StepsAnyImmHashSet(coll.iterator(), coll.size()), false); } /** * Generates a Stream that traverses the keys of a scala.collection.mutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamKeys(scala.collection.mutable.HashMap coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.stream(new StepsAnyHashTableKey(tbl, 0, tbl.length), false); } /** * Generates a Stream that traverses the values of a scala.collection.mutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamValues(scala.collection.mutable.HashMap coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.stream(new StepsAnyDefaultHashTableValue(tbl, 0, tbl.length), false); } /** * Generates a Stream that traverses the key-value pairs of a scala.collection.mutable.HashMap. * The key-value pairs are presented as instances of scala.Tuple2. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream< scala.Tuple2 > stream(scala.collection.mutable.HashMap coll) { scala.collection.mutable.HashEntry< K, scala.collection.mutable.DefaultEntry >[] tbl = CollectionInternals.getTable(coll); return StreamSupport.stream(new StepsAnyDefaultHashTable(tbl, 0, tbl.length), false); } /** * Generates a Stream that traverses a scala.collection.mutable.HashSet. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashSet to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream stream(scala.collection.mutable.HashSet coll) { Object[] tbl = CollectionInternals.getTable(coll); return StreamSupport.stream(new StepsAnyFlatHashTable(tbl, 0, tbl.length), false); } /** * Generates a Stream that traverses a scala.collection.immutable.Vector. *

* Both sequential and parallel operations will be efficient. * * @param coll The Vector to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream stream(scala.collection.immutable.Vector coll) { return StreamSupport.stream(new StepsAnyVector(coll, 0, coll.length()), false); } /** * Generates a Stream that traverses the keys of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the streamAccumulatedKeys method instead, but * note that this creates a new collection containing the Map's keys. * * @param coll The Map to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamKeys(scala.collection.Map coll) { return StreamSupport.stream(new StepsAnyIterator(coll.keysIterator()), false); } /** * Generates a Stream that traverses the values of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the streamAccumulatedValues method instead, but * note that this creates a new collection containing the Map's values. * * @param coll The Map to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamValues(scala.collection.Map coll) { return StreamSupport.stream(new StepsAnyIterator(coll.valuesIterator()), false); } /** * Generates a Stream that traverses the key-value pairs of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the streamAccumulated method instead, but * note that this creates a new collection containing the Map's key-value pairs. * * @param coll The Map to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream< scala.Tuple2 > stream(scala.collection.Map coll) { return StreamSupport.stream(new StepsAnyIterator< scala.Tuple2 >(coll.iterator()), false); } /** * Generates a Stream that traverses a scala.collection.Iterator. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the streamAccumulated method instead, * but note that this creates a copy of the contents of the Iterator. * * @param coll The scala.collection.Iterator to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream stream(scala.collection.Iterator coll) { return StreamSupport.stream(new StepsAnyIterator(coll), false); } /** * Generates a Stream that traverses a scala.collection.Iterable. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the streamAccumulated method instead, * but note that this creates a copy of the contents of the Iterable * * @param coll The scala.collection.Iterable to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream stream(scala.collection.Iterable coll) { return StreamSupport.stream(new StepsAnyIterator(coll.iterator()), false); } /** * Generates a Stream that traverses any Scala collection by accumulating its entries * into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The collection to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamAccumulated(scala.collection.TraversableOnce coll) { scala.compat.java8.collectionImpl.Accumulator acc = scala.compat.java8.collectionImpl.Accumulator.from(coll); return StreamSupport.stream(acc.spliterator(), false); } /** * Generates a Stream that traverses the keys of any Scala map by * accumulating those keys into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing keys to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamAccumulatedKeys(scala.collection.Map coll) { scala.compat.java8.collectionImpl.Accumulator acc = scala.compat.java8.collectionImpl.Accumulator.from(coll.keysIterator()); return StreamSupport.stream(acc.spliterator(), false); } /** * Generates a Stream that traverses the values of any Scala map by * accumulating those values into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing values to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamAccumulatedValues(scala.collection.Map coll) { scala.compat.java8.collectionImpl.Accumulator acc = scala.compat.java8.collectionImpl.Accumulator.from(coll.valuesIterator()); return StreamSupport.stream(acc.spliterator(), false); } //////////////////// // Double Streams // //////////////////// /** * Generates a DoubleStream that traverses an IndexedSeq of Doubles. *

* 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 coll) { return StreamSupport.doubleStream(new StepsDoubleIndexedSeq(coll, 0, coll.length()), false); } /** * Generates a DoubleStream that traverses double-valued keys of a scala.collection.immutable.HashMap. *

* 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 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. *

* 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 coll) { return StreamSupport.doubleStream(new StepsDoubleImmHashMapValue(coll, 0, coll.size()), false); } /** * Generates a DoubleStream that traverses a scala.collection.immutable.HashSet of Doubles. *

* 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 coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.doubleStream(new StepsDoubleImmHashSet(iter, coll.size()), false); } /** * Generates a DoubleStream that traverses double-valued keys of a scala.collection.mutable.HashMap. *

* 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 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 values of a scala.collection.mutable.HashMap. *

* 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 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.mutable.HashSet of Doubles. *

* 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 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. *

* 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 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 the double-valued keys of a scala.collection.Map. *

* 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 coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.keysIterator(); return StreamSupport.doubleStream(new StepsDoubleIterator(iter), false); } /** * Generates a DoubleStream that traverses the double-valued values of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the doubleStreamAccumulatedValues method instead, but * note that this creates a new collection containing the Map's values. * * @param coll The Map to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamValues(scala.collection.Map coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.valuesIterator(); return StreamSupport.doubleStream(new StepsDoubleIterator(iter), false); } /** * Generates a DoubleStream that traverses a double-valued scala.collection.Iterator. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the doubleStreamAccumulated method instead, * but note that this creates a copy of the contents of the Iterator. * * @param coll The scala.collection.Iterator to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.Iterator coll) { return StreamSupport.doubleStream(new StepsDoubleIterator((scala.collection.Iterator)coll), false); } /** * Generates a DoubleStream that traverses a double-valued scala.collection.Iterable. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the doubleStreamAccumulated method instead, * but note that this creates a copy of the contents of the Iterable. * * @param coll The scala.collection.Iterable to traverse * @return A DoubleStream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStream(scala.collection.Iterable coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.doubleStream(new StepsDoubleIterator(iter), false); } /** * Generates a Stream that traverses any Scala collection by accumulating its entries * into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The collection to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamAccumulated(scala.collection.TraversableOnce coll) { scala.compat.java8.collectionImpl.DoubleAccumulator acc = scala.compat.java8.collectionImpl.DoubleAccumulator.from((scala.collection.TraversableOnce)coll); return StreamSupport.doubleStream(acc.spliterator(), false); } /** * Generates a Stream that traverses the keys of any Scala map by * accumulating those keys into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing keys to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamAccumulatedKeys(scala.collection.Map coll) { scala.compat.java8.collectionImpl.DoubleAccumulator acc = scala.compat.java8.collectionImpl.DoubleAccumulator.from((scala.collection.Iterator)coll.keysIterator()); return StreamSupport.doubleStream(acc.spliterator(), false); } /** * Generates a Stream that traverses the values of any Scala map by * accumulating those values into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing values to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static DoubleStream doubleStreamAccumulatedValues(scala.collection.Map coll) { scala.compat.java8.collectionImpl.DoubleAccumulator acc = scala.compat.java8.collectionImpl.DoubleAccumulator.from((scala.collection.Iterator)coll.valuesIterator()); return StreamSupport.doubleStream(acc.spliterator(), false); } ///////////////// // Int Streams // ///////////////// /** * Generates a IntStream that traverses a BitSet. *

* Both sequential and parallel operations will be efficient. * * @param coll The BitSet to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.BitSet coll) { // Let the value class figure out the casting! scala.compat.java8.converterImpl.RichBitSetCanStep rbscs = new scala.compat.java8.converterImpl.RichBitSetCanStep(coll); return StreamSupport.intStream(rbscs.stepper(), false); } /** * Generates a IntStream that traverses a Range. *

* Both sequential and parallel operations will be efficient. * * @param coll The Range to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.immutable.Range coll) { return StreamSupport.intStream(new scala.compat.java8.converterImpl.StepsIntRange(coll, 0, coll.length()), false); } /** * Generates a IntStream that traverses an IndexedSeq of Ints. *

* Both sequential and parallel operations will be efficient. * * @param coll The IndexedSeq to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.IndexedSeq coll) { return StreamSupport.intStream(new StepsIntIndexedSeq(coll, 0, coll.length()), false); } /** * Generates a IntStream that traverses int-valued keys of a scala.collection.immutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamKeys(scala.collection.immutable.HashMap coll) { return StreamSupport.intStream(new StepsIntImmHashMapKey(coll, 0, coll.size()), false); } /** * Generates a IntStream that traverses int-valued values of a scala.collection.immutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamValues(scala.collection.immutable.HashMap coll) { return StreamSupport.intStream(new StepsIntImmHashMapValue(coll, 0, coll.size()), false); } /** * Generates a IntStream that traverses a scala.collection.immutable.HashSet of Ints. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashSet to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.immutable.HashSet coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.intStream(new StepsIntImmHashSet(iter, coll.size()), false); } /** * Generates a IntStream that traverses int-valued keys of a scala.collection.mutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamKeys(scala.collection.mutable.HashMap coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.intStream(new StepsIntHashTableKey(tbl, 0, tbl.length), false); } /** * Generates a IntStream that traverses int-valued values of a scala.collection.mutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamValues(scala.collection.mutable.HashMap coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.intStream(new StepsIntDefaultHashTableValue(tbl, 0, tbl.length), false); } /** * Generates a IntStream that traverses a scala.collection.mutable.HashSet of Ints. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashSet to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.mutable.HashSet coll) { Object[] tbl = CollectionInternals.getTable(coll); return StreamSupport.intStream(new StepsIntFlatHashTable(tbl, 0, tbl.length), false); } /** * Generates a IntStream that traverses a scala.collection.immutable.Vector of Ints. *

* Both sequential and parallel operations will be efficient. * * @param coll The Vector to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.immutable.Vector coll) { scala.collection.immutable.Vector erased = (scala.collection.immutable.Vector)coll; return StreamSupport.intStream(new StepsIntVector(erased, 0, coll.length()), false); } /** * Generates a IntStream that traverses the int-valued keys of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the intStreamAccumulatedKeys method instead, but * note that this creates a new collection containing the Map's keys. * * @param coll The Map to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamKeys(scala.collection.Map coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.keysIterator(); return StreamSupport.intStream(new StepsIntIterator(iter), false); } /** * Generates a IntStream that traverses the int-valued values of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the intStreamAccumulatedValues method instead, but * note that this creates a new collection containing the Map's values. * * @param coll The Map to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamValues(scala.collection.Map coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.valuesIterator(); return StreamSupport.intStream(new StepsIntIterator(iter), false); } /** * Generates a IntStream that traverses a int-valued scala.collection.Iterator. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the intStreamAccumulated method instead, * but note that this creates a copy of the contents of the Iterator. * * @param coll The scala.collection.Iterator to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.Iterator coll) { return StreamSupport.intStream(new StepsIntIterator((scala.collection.Iterator)coll), false); } /** * Generates a IntStream that traverses a int-valued scala.collection.Iterable. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the intStreamAccumulated method instead, * but note that this creates a copy of the contents of the Iterable. * * @param coll The scala.collection.Iterable to traverse * @return A IntStream view of the collection which, by default, executes sequentially. */ public static IntStream intStream(scala.collection.Iterable coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.intStream(new StepsIntIterator(iter), false); } /** * Generates a Stream that traverses any Scala collection by accumulating its entries * into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The collection to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamAccumulated(scala.collection.TraversableOnce coll) { scala.compat.java8.collectionImpl.IntAccumulator acc = scala.compat.java8.collectionImpl.IntAccumulator.from((scala.collection.TraversableOnce)coll); return StreamSupport.intStream(acc.spliterator(), false); } /** * Generates a Stream that traverses the keys of any Scala map by * accumulating those keys into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing keys to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamAccumulatedKeys(scala.collection.Map coll) { scala.compat.java8.collectionImpl.IntAccumulator acc = scala.compat.java8.collectionImpl.IntAccumulator.from((scala.collection.Iterator)coll.keysIterator()); return StreamSupport.intStream(acc.spliterator(), false); } /** * Generates a Stream that traverses the values of any Scala map by * accumulating those values into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing values to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static IntStream intStreamAccumulatedValues(scala.collection.Map coll) { scala.compat.java8.collectionImpl.IntAccumulator acc = scala.compat.java8.collectionImpl.IntAccumulator.from((scala.collection.Iterator)coll.valuesIterator()); return StreamSupport.intStream(acc.spliterator(), false); } ////////////////// // Long Streams // ////////////////// /** * Generates a LongStream that traverses an IndexedSeq of Longs. *

* Both sequential and parallel operations will be efficient. * * @param coll The IndexedSeq to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStream(scala.collection.IndexedSeq coll) { return StreamSupport.longStream(new StepsLongIndexedSeq(coll, 0, coll.length()), false); } /** * Generates a LongStream that traverses long-valued keys of a scala.collection.immutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamKeys(scala.collection.immutable.HashMap coll) { return StreamSupport.longStream(new StepsLongImmHashMapKey(coll, 0, coll.size()), false); } /** * Generates a LongStream that traverses long-valued values of a scala.collection.immutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashMap to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamValues(scala.collection.immutable.HashMap coll) { return StreamSupport.longStream(new StepsLongImmHashMapValue(coll, 0, coll.size()), false); } /** * Generates a LongStream that traverses a scala.collection.immutable.HashSet of Longs. *

* Both sequential and parallel operations will be efficient. * * @param coll The immutable.HashSet to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStream(scala.collection.immutable.HashSet coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.longStream(new StepsLongImmHashSet(iter, coll.size()), false); } /** * Generates a LongStream that traverses long-valued keys of a scala.collection.mutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamKeys(scala.collection.mutable.HashMap coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.longStream(new StepsLongHashTableKey(tbl, 0, tbl.length), false); } /** * Generates a LongStream that traverses long-valued values of a scala.collection.mutable.HashMap. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashMap to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamValues(scala.collection.mutable.HashMap coll) { scala.collection.mutable.HashEntry[] tbl = CollectionInternals.getTable(coll); return StreamSupport.longStream(new StepsLongDefaultHashTableValue(tbl, 0, tbl.length), false); } /** * Generates a LongStream that traverses a scala.collection.mutable.HashSet of Longs. *

* Both sequential and parallel operations will be efficient. * * @param coll The mutable.HashSet to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStream(scala.collection.mutable.HashSet coll) { Object[] tbl = CollectionInternals.getTable(coll); return StreamSupport.longStream(new StepsLongFlatHashTable(tbl, 0, tbl.length), false); } /** * Generates a LongStream that traverses a scala.collection.immutable.Vector of Longs. *

* Both sequential and parallel operations will be efficient. * * @param coll The Vector to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStream(scala.collection.immutable.Vector coll) { scala.collection.immutable.Vector erased = (scala.collection.immutable.Vector)coll; return StreamSupport.longStream(new StepsLongVector(erased, 0, coll.length()), false); } /** * Generates a LongStream that traverses the long-valued keys of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the longStreamAccumulatedKeys method instead, but * note that this creates a new collection containing the Map's keys. * * @param coll The Map to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamKeys(scala.collection.Map coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.keysIterator(); return StreamSupport.longStream(new StepsLongIterator(iter), false); } /** * Generates a LongStream that traverses the long-valued values of a scala.collection.Map. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the longStreamAccumulatedValues method instead, but * note that this creates a new collection containing the Map's values. * * @param coll The Map to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamValues(scala.collection.Map coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.valuesIterator(); return StreamSupport.longStream(new StepsLongIterator(iter), false); } /** * Generates a LongStream that traverses a long-valued scala.collection.Iterator. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the longStreamAccumulated method instead, * but note that this creates a copy of the contents of the Iterator. * * @param coll The scala.collection.Iterator to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStream(scala.collection.Iterator coll) { return StreamSupport.longStream(new StepsLongIterator((scala.collection.Iterator)coll), false); } /** * Generates a LongStream that traverses a long-valued scala.collection.Iterable. *

* Only sequential operations will be efficient. * For efficient parallel operation, use the longStreamAccumulated method instead, * but note that this creates a copy of the contents of the Iterable. * * @param coll The scala.collection.Iterable to traverse * @return A LongStream view of the collection which, by default, executes sequentially. */ public static LongStream longStream(scala.collection.Iterable coll) { scala.collection.Iterator iter = (scala.collection.Iterator)coll.iterator(); return StreamSupport.longStream(new StepsLongIterator(iter), false); } /** * Generates a Stream that traverses any Scala collection by accumulating its entries * into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The collection to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamAccumulated(scala.collection.TraversableOnce coll) { scala.compat.java8.collectionImpl.LongAccumulator acc = scala.compat.java8.collectionImpl.LongAccumulator.from((scala.collection.TraversableOnce)coll); return StreamSupport.longStream(acc.spliterator(), false); } /** * Generates a Stream that traverses the keys of any Scala map by * accumulating those keys into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing keys to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamAccumulatedKeys(scala.collection.Map coll) { scala.compat.java8.collectionImpl.LongAccumulator acc = scala.compat.java8.collectionImpl.LongAccumulator.from((scala.collection.Iterator)coll.keysIterator()); return StreamSupport.longStream(acc.spliterator(), false); } /** * Generates a Stream that traverses the values of any Scala map by * accumulating those values into a buffer class (Accumulator). *

* Both sequential and parallel operations will be efficient. * * @param coll The map containing values to traverse * @return A Stream view of the collection which, by default, executes sequentially. */ public static LongStream longStreamAccumulatedValues(scala.collection.Map coll) { scala.compat.java8.collectionImpl.LongAccumulator acc = scala.compat.java8.collectionImpl.LongAccumulator.from((scala.collection.Iterator)coll.valuesIterator()); return StreamSupport.longStream(acc.spliterator(), false); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy