Class Stream<T>

java.lang.Object
com.landawn.abacus.util.stream.Stream<T>
Type Parameters:
T - the type of the stream elements
All Implemented Interfaces:
Immutable, BaseStream<T,Object[],Predicate<? super T>,Consumer<? super T>,List<T>,u.Optional<T>,Indexed<T>,ObjIterator<T>,Stream<T>>, Closeable, AutoCloseable
Direct Known Subclasses:
Stream.StreamEx

@Immutable public abstract class Stream<T> extends Object
Note: This class includes codes copied from StreamEx: https://github.com/amaembo/streamex under Apache License, version 2.0.
The Stream will be automatically closed after execution(A terminal method is executed/triggered).
See Also:
  • Method Details

    • select

      @SequentialOnly @IntermediateOp public <U> Stream<U> select(Class<? extends U> targetType)
      Select the elements belong to the specified targetType(including its subtype).
      Type Parameters:
      U -
      Parameters:
      targetType -
      Returns:
    • skipUntil

      @SequentialOnly @Beta @IntermediateOp public Stream<T> skipUntil(Predicate<? super T> predicate)
      Parameters:
      predicate -
      Returns:
      See Also:
    • map

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> map(Function<? super T,? extends R> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • pairWith

      @ParallelSupported @IntermediateOp public <U> Stream<Pair<T,U>> pairWith(Function<? super T,? extends U> extractor)
      Type Parameters:
      U -
      Parameters:
      extractor -
      Returns:
    • slidingMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,? extends R> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • slidingMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,? extends R> mapper, int increment)
      Slide with windowSize = 2 and the specified increment, then map by the specified mapper.
      Type Parameters:
      R -
      Parameters:
      mapper -
      increment -
      Returns:
    • slidingMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,? extends R> mapper, int increment, boolean ignoreNotPaired)
      Type Parameters:
      R -
      Parameters:
      mapper -
      increment -
      ignoreNotPaired -
      Returns:
    • slidingMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,? extends R> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • slidingMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,? extends R> mapper, int increment)
      Slide with windowSize = 3 and the specified increment, then map by the specified mapper.
      Type Parameters:
      R -
      Parameters:
      mapper -
      increment -
      Returns:
    • slidingMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,? extends R> mapper, int increment, boolean ignoreNotPaired)
      Type Parameters:
      R -
      Parameters:
      mapper -
      increment -
      ignoreNotPaired -
      Returns:
    • rangeMap

      @SequentialOnly @IntermediateOp public abstract <U> Stream<U> rangeMap(BiPredicate<? super T,? super T> sameRange, BiFunction<? super T,? super T,? extends U> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Returns a stream consisting of results of applying the given function to the ranges created from the source elements.
       
       Stream.of("a", "ab", "ac", "b", "c", "cb").rangeMap((a, b) -> b.startsWith(a), (a, b) -> a + "->" + b).toList(); // a->ac, b->b, c->cb
       
       

      This is a quasi-intermediate partial reduction operation.

      Type Parameters:
      U - the type of the resulting elements
      Parameters:
      sameRange - a non-interfering, stateless predicate to apply to the leftmost and next elements which returns true for elements which belong to the same range.
      mapper - a non-interfering, stateless function to apply to the range borders and produce the resulting element. If value was not merged to the interval, then mapper will receive the same value twice, otherwise it will receive the leftmost and the rightmost values which were merged to the range.
      Returns:
      See Also:
      • #collapse(BiPredicate, BinaryOperator)
    • mapFirst

      @SequentialOnly @IntermediateOp public abstract Stream<T> mapFirst(Function<? super T,? extends T> mapperForFirst)
      Parameters:
      mapperForFirst -
      Returns:
    • mapFirstOrElse

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapFirstOrElse(Function<? super T,? extends R> mapperForFirst, Function<? super T,? extends R> mapperForElse)
      Type Parameters:
      R -
      Parameters:
      mapperForFirst -
      mapperForElse -
      Returns:
    • mapLast

      @SequentialOnly @IntermediateOp public abstract Stream<T> mapLast(Function<? super T,? extends T> mapperForLast)
      Parameters:
      mapperForLast -
      Returns:
    • mapLastOrElse

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapLastOrElse(Function<? super T,? extends R> mapperForLast, Function<? super T,? extends R> mapperForElse)
      Type Parameters:
      R -
      Parameters:
      mapperForLast -
      mapperForElse -
      Returns:
    • mapToChar

      @ParallelSupported @IntermediateOp public abstract CharStream mapToChar(ToCharFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • mapToByte

      @ParallelSupported @IntermediateOp public abstract ByteStream mapToByte(ToByteFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • mapToShort

      @ParallelSupported @IntermediateOp public abstract ShortStream mapToShort(ToShortFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • mapToInt

      @ParallelSupported @IntermediateOp public abstract IntStream mapToInt(ToIntFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • mapToLong

      @ParallelSupported @IntermediateOp public abstract LongStream mapToLong(ToLongFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • mapToFloat

      @ParallelSupported @IntermediateOp public abstract FloatStream mapToFloat(ToFloatFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • mapToDouble

      @ParallelSupported @IntermediateOp public abstract DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • mapToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> mapToEntry(Function<? super T,? extends Map.Entry<? extends K,? extends V>> mapper)
      Type Parameters:
      K -
      V -
      Parameters:
      mapper -
      Returns:
    • mapToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> mapToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
    • flatMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • flatmap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatmap(Function<? super T,? extends Collection<? extends R>> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • flattMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flattMap(Function<? super T,R[]> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • flattmap

      @Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flattmap(Function<? super T,? extends Stream<? extends R>> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • flatMapToChar

      @ParallelSupported @IntermediateOp public abstract CharStream flatMapToChar(Function<? super T,? extends CharStream> mapper)
      Parameters:
      mapper -
      Returns:
    • flatmapToChar

      @ParallelSupported @IntermediateOp public abstract CharStream flatmapToChar(Function<? super T,char[]> mapper)
      Parameters:
      mapper -
      Returns:
    • flatMapToByte

      @ParallelSupported @IntermediateOp public abstract ByteStream flatMapToByte(Function<? super T,? extends ByteStream> mapper)
      Parameters:
      mapper -
      Returns:
    • flatmapToByte

      @ParallelSupported @IntermediateOp public abstract ByteStream flatmapToByte(Function<? super T,byte[]> mapper)
      Parameters:
      mapper -
      Returns:
    • flatMapToShort

      @ParallelSupported @IntermediateOp public abstract ShortStream flatMapToShort(Function<? super T,? extends ShortStream> mapper)
      Parameters:
      mapper -
      Returns:
    • flatmapToShort

      @ParallelSupported @IntermediateOp public abstract ShortStream flatmapToShort(Function<? super T,short[]> mapper)
      Parameters:
      mapper -
      Returns:
    • flatMapToInt

      @ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(Function<? super T,? extends IntStream> mapper)
      Parameters:
      mapper -
      Returns:
    • flatmapToInt

      @ParallelSupported @IntermediateOp public abstract IntStream flatmapToInt(Function<? super T,int[]> mapper)
      Parameters:
      mapper -
      Returns:
    • flatMapToLong

      @ParallelSupported @IntermediateOp public abstract LongStream flatMapToLong(Function<? super T,? extends LongStream> mapper)
      Parameters:
      mapper -
      Returns:
    • flatmapToLong

      @ParallelSupported @IntermediateOp public abstract LongStream flatmapToLong(Function<? super T,long[]> mapper)
      Parameters:
      mapper -
      Returns:
    • flatMapToFloat

      @ParallelSupported @IntermediateOp public abstract FloatStream flatMapToFloat(Function<? super T,? extends FloatStream> mapper)
      Parameters:
      mapper -
      Returns:
    • flatmapToFloat

      @ParallelSupported @IntermediateOp public abstract FloatStream flatmapToFloat(Function<? super T,float[]> mapper)
      Parameters:
      mapper -
      Returns:
    • flatMapToDouble

      @ParallelSupported @IntermediateOp public abstract DoubleStream flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
      Parameters:
      mapper -
      Returns:
    • flatmapToDouble

      @ParallelSupported @IntermediateOp public abstract DoubleStream flatmapToDouble(Function<? super T,double[]> mapper)
      Parameters:
      mapper -
      Returns:
    • flatMapToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> flatMapToEntry(Function<? super T,? extends Stream<? extends Map.Entry<? extends K,? extends V>>> mapper)
      Type Parameters:
      K -
      V -
      Parameters:
      mapper -
      Returns:
    • flatmapToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> flatmapToEntry(Function<? super T,? extends Map<? extends K,? extends V>> mapper)
      Type Parameters:
      K -
      V -
      Parameters:
      mapper -
      Returns:
    • flattMapToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> flattMapToEntry(Function<? super T,? extends EntryStream<? extends K,? extends V>> mapper)
      Type Parameters:
      K -
      V -
      Parameters:
      mapper -
      Returns:
    • flatMapIfNotNull

      @Beta @ParallelSupported @IntermediateOp public <R> Stream<R> flatMapIfNotNull(Function<? super T,? extends Collection<? extends R>> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • flatMapIfNotNull

      @Beta @ParallelSupported @IntermediateOp public <U, R> Stream<R> flatMapIfNotNull(Function<? super T,? extends Collection<? extends U>> mapper, Function<? super U,? extends Collection<? extends R>> mapper2)
      Type Parameters:
      U -
      R -
      Parameters:
      mapper -
      mapper2 -
      Returns:
    • mapMulti

      @Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapMulti(BiConsumer<? super T,? super Consumer<R>> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • mapMultiToInt

      @Beta @ParallelSupported @IntermediateOp public abstract IntStream mapMultiToInt(BiConsumer<? super T,? super IntConsumer> mapper)
      Parameters:
      mapper -
      Returns:
    • mapMultiToLong

      @Beta @ParallelSupported @IntermediateOp public abstract LongStream mapMultiToLong(BiConsumer<? super T,? super LongConsumer> mapper)
      Parameters:
      mapper -
      Returns:
    • mapMultiToDouble

      @Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapMultiToDouble(BiConsumer<? super T,? super DoubleConsumer> mapper)
      Parameters:
      mapper -
      Returns:
    • mapPartial

      @Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapPartial(Function<? super T,u.Optional<? extends R>> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • mapPartialToInt

      @Beta @ParallelSupported @IntermediateOp public abstract IntStream mapPartialToInt(Function<? super T,u.OptionalInt> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Parameters:
      mapper -
      Returns:
    • mapPartialToLong

      @Beta @ParallelSupported @IntermediateOp public abstract LongStream mapPartialToLong(Function<? super T,u.OptionalLong> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Parameters:
      mapper -
      Returns:
    • mapPartialToDouble

      @Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapPartialToDouble(Function<? super T,u.OptionalDouble> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Parameters:
      mapper -
      Returns:
    • mapPartialJdk

      @Beta @ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapPartialJdk(Function<? super T,Optional<? extends R>> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
    • mapPartialToIntJdk

      @Beta @ParallelSupported @IntermediateOp public abstract IntStream mapPartialToIntJdk(Function<? super T,OptionalInt> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Parameters:
      mapper -
      Returns:
    • mapPartialToLongJdk

      @Beta @ParallelSupported @IntermediateOp public abstract LongStream mapPartialToLongJdk(Function<? super T,OptionalLong> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Parameters:
      mapper -
      Returns:
    • mapPartialToDoubleJdk

      @Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapPartialToDoubleJdk(Function<? super T,OptionalDouble> mapper)
      Note: copied from StreamEx: https://github.com/amaembo/streamex
      Parameters:
      mapper -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> Stream<Map.Entry<K,List<T>>> groupBy(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> Stream<Map.Entry<K,List<T>>> groupBy(Function<? super T,? extends K> keyMapper, Supplier<? extends Map<K,List<T>>> mapFactory)
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K,List<V>>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      See Also:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K,List<V>>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends Map<K,List<V>>> mapFactory)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Collector<? super T,?,D> downstream)
      Type Parameters:
      K -
      D -
      Parameters:
      keyMapper -
      downstream -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Collector<? super T,?,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
      Type Parameters:
      K -
      D -
      Parameters:
      keyMapper -
      downstream -
      mapFactory -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,?,D> downstream)
      Type Parameters:
      K -
      V -
      D -
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,?,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
      Type Parameters:
      K -
      V -
      D -
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      mapFactory -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K,V>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
    • groupBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> Stream<Map.Entry<K,V>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K,V>> mapFactory)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      mapFactory -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> EntryStream<K,List<T>> groupByToEntry(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> EntryStream<K,List<T>> groupByToEntry(Function<? super T,? extends K> keyMapper, Supplier<? extends Map<K,List<T>>> mapFactory)
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K,List<V>> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      See Also:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K,List<V>> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends Map<K,List<V>>> mapFactory)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Collector<? super T,?,D> downstream)
      Type Parameters:
      K -
      D -
      Parameters:
      keyMapper -
      downstream -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Collector<? super T,?,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
      Type Parameters:
      K -
      D -
      Parameters:
      keyMapper -
      downstream -
      mapFactory -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,?,D> downstream)
      Type Parameters:
      K -
      V -
      D -
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,?,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
      Type Parameters:
      K -
      V -
      D -
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      mapFactory -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K,V> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V> EntryStream<K,V> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K,V>> mapFactory)
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      mapFactory -
      Returns:
    • partitionBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<Map.Entry<Boolean,List<T>>> partitionBy(Predicate<? super T> predicate)
      Parameters:
      predicate -
      Returns:
      See Also:
    • partitionBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <D> Stream<Map.Entry<Boolean,D>> partitionBy(Predicate<? super T> predicate, Collector<? super T,?,D> downstream)
      Type Parameters:
      D -
      Parameters:
      predicate -
      downstream -
      Returns:
      See Also:
    • partitionByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract EntryStream<Boolean,List<T>> partitionByToEntry(Predicate<? super T> predicate)
      Parameters:
      predicate -
      Returns:
      See Also:
    • partitionByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <D> EntryStream<Boolean,D> partitionByToEntry(Predicate<? super T> predicate, Collector<? super T,?,D> downstream)
      Type Parameters:
      D -
      Parameters:
      predicate -
      downstream -
      Returns:
      See Also:
    • countBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<Map.Entry<K,Integer>> countBy(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      Returns:
    • countByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> EntryStream<K,Integer> countByToEntry(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      Returns:
    • collapse

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> collapse(BiPredicate<? super T,? super T> collapsible)
      Parameters:
      collapsible - test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.
      Returns:
    • collapse

      @SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> collapse(BiPredicate<? super T,? super T> collapsible, Supplier<? extends C> supplier)
      Type Parameters:
      C -
      Parameters:
      collapsible - test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.
      supplier -
      Returns:
    • collapse

      @SequentialOnly @IntermediateOp public abstract Stream<T> collapse(BiPredicate<? super T,? super T> collapsible, BiFunction<? super T,? super T,T> mergeFunction)
      Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.

      Example:

       
       Stream.of(new Integer[0]).collapse((p, c) -> p < c, (r, c) -> r + c) => []
       Stream.of(1).collapse((p, c) -> p < c, (r, c) -> r + c) => [1]
       Stream.of(1, 2).collapse((p, c) -> p < c, (r, c) -> r + c) => [3]
       Stream.of(1, 2, 3).collapse((p, c) -> p < c, (r, c) -> r + c) => [6]
       Stream.of(1, 2, 3, 3, 2, 1).collapse((p, c) -> p < c, (r, c) -> r + c) => [6, 3, 2, 1]
       
       

      This method only runs sequentially, even in parallel stream.
      Parameters:
      collapsible - test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.
      mergeFunction -
      Returns:
    • collapse

      @SequentialOnly @IntermediateOp public abstract <U> Stream<U> collapse(BiPredicate<? super T,? super T> collapsible, U init, BiFunction<U,? super T,U> op)
      Type Parameters:
      U -
      Parameters:
      collapsible - test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.
      init - is used by op to generate the first result value in the series.
      op -
      Returns:
    • collapse

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> collapse(BiPredicate<? super T,? super T> collapsible, Supplier<R> supplier, BiConsumer<? super R,? super T> accumulator)
      Type Parameters:
      R -
      Parameters:
      collapsible - test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.
      supplier -
      accumulator -
      Returns:
    • collapse

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> collapse(BiPredicate<? super T,? super T> collapsible, Collector<? super T,?,R> collector)
      Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.

      Example:

       
       Stream.of(new Integer[0]).collapse((p, c) -> p < c, Collectors.summingInt(Fn.unboxI())) => []
       Stream.of(1).collapse((p, c) -> p < c, Collectors.summingInt(Fn.unboxI())) => [1]
       Stream.of(1, 2).collapse((p, c) -> p < c, Collectors.summingInt(Fn.unboxI())) => [3]
       Stream.of(1, 2, 3).collapse((p, c) -> p < c, Collectors.summingInt(Fn.unboxI())) => [6]
       Stream.of(1, 2, 3, 3, 2, 1).collapse((p, c) -> p < c, Collectors.summingInt(Fn.unboxI())) => [6, 3, 2, 1]
       
       

      This method only runs sequentially, even in parallel stream.
      Type Parameters:
      R -
      Parameters:
      collapsible - test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.
      collector -
      Returns:
    • collapse

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<List<T>> collapse(TriPredicate<? super T,? super T,? super T> collapsible)
      Parameters:
      collapsible - test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.
      Returns:
    • collapse

      @Beta @SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> collapse(TriPredicate<? super T,? super T,? super T> collapsible, Supplier<? extends C> supplier)
      Type Parameters:
      C -
      Parameters:
      collapsible - test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.
      supplier -
      Returns:
    • collapse

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> collapse(TriPredicate<? super T,? super T,? super T> collapsible, BiFunction<? super T,? super T,T> mergeFunction)
      Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.

      Example:

       
       Stream.of(new Integer[0]).collapse((f, p, c) -> f < c, (r, c) -> r + c) => []
       Stream.of(1).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [1]
       Stream.of(1, 2).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [3]
       Stream.of(1, 2, 3).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [6]
       Stream.of(1, 2, 3, 3, 2, 1).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [11, 1]
       
       

      This method only runs sequentially, even in parallel stream.
      Parameters:
      collapsible - test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.
      mergeFunction -
      Returns:
    • collapse

      @Beta @SequentialOnly @IntermediateOp public abstract <U> Stream<U> collapse(TriPredicate<? super T,? super T,? super T> collapsible, U init, BiFunction<U,? super T,U> op)
      Type Parameters:
      U -
      Parameters:
      collapsible - test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.
      init - is used by op to generate the first result value in the series.
      op -
      Returns:
    • collapse

      @Beta @SequentialOnly @IntermediateOp public abstract <R> Stream<R> collapse(TriPredicate<? super T,? super T,? super T> collapsible, Supplier<R> supplier, BiConsumer<? super R,? super T> accumulator)
      Type Parameters:
      R -
      Parameters:
      collapsible - test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.
      supplier -
      accumulator -
      Returns:
    • collapse

      @Beta @SequentialOnly @IntermediateOp public abstract <R> Stream<R> collapse(TriPredicate<? super T,? super T,? super T> collapsible, Collector<? super T,?,R> collector)
      Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.

      Example:

       
       Stream.of(new Integer[0]).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => []
       Stream.of(1).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [1]
       Stream.of(1, 2).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [3]
       Stream.of(1, 2, 3).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [6]
       Stream.of(1, 2, 3, 3, 2, 1).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [11, 1]
       
       

      This method only runs sequentially, even in parallel stream.
      Type Parameters:
      R -
      Parameters:
      collapsible - test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.
      collector -
      Returns:
    • scan

      @SequentialOnly @IntermediateOp public abstract Stream<T> scan(BiFunction<? super T,? super T,T> accumulator)
      Returns a Stream produced by iterative application of a accumulation function to an initial element init and next element of the current stream. Produces a Stream consisting of init, acc(init, value1), acc(acc(init, value1), value2), etc.

      This is an intermediate operation.

      Example:

       
       Stream.of(new Integer[0]).scan((r, c) -> r + c) => []
       Stream.of(1).scan((r, c) -> r + c) => [1]
       Stream.of(1, 2).scan((r, c) -> r + c) => [1, 3]
       Stream.of(1, 2, 3).scan((r, c) -> r + c) => [1, 3, 6]
       Stream.of(1, 2, 3, 3, 2, 1).scan((r, c) -> r + c) => [1, 3, 6, 9, 11, 12]
       
       

      This method only runs sequentially, even in parallel stream.
      Parameters:
      accumulator - the accumulation function
      Returns:
    • scan

      @SequentialOnly @IntermediateOp public abstract <U> Stream<U> scan(U init, BiFunction<U,? super T,U> accumulator)
      Returns a Stream produced by iterative application of a accumulation function to an initial element init and next element of the current stream. Produces a Stream consisting of init, acc(init, value1), acc(acc(init, value1), value2), etc.

      This is an intermediate operation.

      Example:

       
       Stream.of(new Integer[0]).scan(10, (r, c) -> r + c) => []
       Stream.of(1).scan(10, (r, c) -> r + c) => [11]
       Stream.of(1, 2).scan(10, (r, c) -> r + c) => [11, 13]
       Stream.of(1, 2, 3).scan(10, (r, c) -> r + c) => [11, 13, 16]
       Stream.of(1, 2, 3, 3, 2, 1).scan(10, (r, c) -> r + c) => [11, 13, 16, 19, 21, 22]
       
       

      This method only runs sequentially, even in parallel stream.
      Type Parameters:
      U -
      Parameters:
      init - the initial value. it's only used once by accumulator to calculate the fist element in the returned stream. It will be ignored if this stream is empty and won't be the first element of the returned stream.
      accumulator - the accumulation function
      Returns:
    • scan

      @SequentialOnly @IntermediateOp public abstract <U> Stream<U> scan(U init, BiFunction<U,? super T,U> accumulator, boolean initIncluded)
      Type Parameters:
      U -
      Parameters:
      init -
      accumulator -
      initIncluded -
      Returns:
    • splitToSet

      @SequentialOnly @IntermediateOp public abstract Stream<Set<T>> splitToSet(int chunkSize)
      Returns Stream of Stream with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
      This method only runs sequentially, even in parallel stream.
      Parameters:
      chunkSize - the desired size of each sub sequence (the last may be smaller).
      Returns:
    • split

      @SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> split(int chunkSize, IntFunction<? extends C> collectionSupplier)
      Returns Stream of Stream with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
      This method only runs sequentially, even in parallel stream.
      Type Parameters:
      C -
      Parameters:
      chunkSize - the desired size of each sub sequence (the last may be smaller).
      collectionSupplier -
      Returns:
    • split

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> split(int chunkSize, Collector<? super T,?,R> collector)
      Type Parameters:
      R -
      Parameters:
      chunkSize - the desired size of each sub sequence (the last may be smaller).
      collector -
      Returns:
    • splitToSet

      @SequentialOnly @IntermediateOp public abstract Stream<Set<T>> splitToSet(Predicate<? super T> predicate)
      Parameters:
      predicate -
      Returns:
    • split

      @SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> split(Predicate<? super T> predicate, Supplier<? extends C> collectionSupplier)
      Type Parameters:
      C -
      Parameters:
      predicate -
      collectionSupplier -
      Returns:
    • split

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> split(Predicate<? super T> predicate, Collector<? super T,?,R> collector)
      Type Parameters:
      R -
      Parameters:
      predicate -
      collector -
      Returns:
    • splitAt

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> splitAt(int where, Collector<? super T,?,R> collector)
      Split the stream into two pieces at where turns to false. The first piece will be loaded into memory.
      Type Parameters:
      R -
      Parameters:
      where -
      collector -
      Returns:
    • splitAt

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> splitAt(Predicate<? super T> where, Collector<? super T,?,R> collector)
      Split the stream into two pieces at where turns to false. The first piece will be loaded into memory.
      Type Parameters:
      R -
      Parameters:
      where -
      collector -
      Returns:
    • slidingToSet

      @SequentialOnly @IntermediateOp public Stream<Set<T>> slidingToSet(int windowSize)
      Parameters:
      windowSize -
      Returns:
      See Also:
    • slidingToSet

      @SequentialOnly @IntermediateOp public abstract Stream<Set<T>> slidingToSet(int windowSize, int increment)
      Parameters:
      windowSize -
      increment -
      Returns:
      See Also:
    • sliding

      @SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> sliding(int windowSize, IntFunction<? extends C> collectionSupplier)
      Type Parameters:
      C -
      Parameters:
      windowSize -
      collectionSupplier -
      Returns:
    • sliding

      @SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> sliding(int windowSize, int increment, IntFunction<? extends C> collectionSupplier)
      Type Parameters:
      C -
      Parameters:
      windowSize -
      increment -
      collectionSupplier -
      Returns:
    • sliding

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> sliding(int windowSize, Collector<? super T,?,R> collector)
      Type Parameters:
      R -
      Parameters:
      windowSize -
      collector -
      Returns:
    • sliding

      @SequentialOnly @IntermediateOp public abstract <R> Stream<R> sliding(int windowSize, int increment, Collector<? super T,?,R> collector)
      Type Parameters:
      R -
      Parameters:
      windowSize -
      increment -
      collector -
      Returns:
    • intersperse

      @SequentialOnly @IntermediateOp public abstract Stream<T> intersperse(T delimiter)
      Stream.of(1).intersperse(9) --> [1] Stream.of(1, 2, 3).intersperse(9) --> [1, 9, 2, 9, 3]
      This method only runs sequentially, even in parallel stream.
      Parameters:
      delimiter -
      Returns:
    • distinct

      Distinct and merge duplicated elements.
      Parameters:
      mergeFunction -
      Returns:
      See Also:
    • distinct

      @SequentialOnly @IntermediateOp @TerminalOpTriggered public Stream<T> distinct(Predicate<? super Long> occurrencesFilter)
      Distinct and filter by occurrences.
      Parameters:
      occurrencesFilter -
      Returns:
    • distinctBy

      @ParallelSupported @IntermediateOp public abstract Stream<T> distinctBy(Function<? super T,?> keyMapper)
      Distinct by the value mapped from keyMapper.
      Parameters:
      keyMapper - don't change value of the input parameter.
      Returns:
    • distinctBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<T> distinctBy(Function<? super T,K> keyMapper, BinaryOperator<T> mergeFunction)
      Distinct and merge duplicated elements.
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      mergeFunction -
      Returns:
      See Also:
    • distinctBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<T> distinctBy(Function<? super T,K> keyMapper, Predicate<? super Map.Entry<Keyed<K,T>,Long>> occurrencesFilter)
      Distinct and filter by occurrences.
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      occurrencesFilter -
      Returns:
      See Also:
    • distinctLimitBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<T> distinctLimitBy(Function<? super T,K> keyMapper, BiFunction<? super K,? super List<T>,Integer> limit)
      Distinct and limit by keyMapper
      Type Parameters:
      K -
      Parameters:
      keyMapper -
      limit -
      Returns:
      See Also:
    • sorted

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sorted(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • sortedBy

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedBy(Function<? super T,? extends Comparable> keyMapper)
      Parameters:
      keyMapper -
      Returns:
    • sortedByInt

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByInt(ToIntFunction<? super T> keyMapper)
      Parameters:
      keyMapper -
      Returns:
    • sortedByLong

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByLong(ToLongFunction<? super T> keyMapper)
      Parameters:
      keyMapper -
      Returns:
    • sortedByDouble

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByDouble(ToDoubleFunction<? super T> keyMapper)
      Parameters:
      keyMapper -
      Returns:
    • reverseSorted

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> reverseSorted(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • top

      @SequentialOnly @IntermediateOp public abstract Stream<T> top(int n)

      This method only runs sequentially, even in parallel stream.
      Parameters:
      n -
      Returns:
    • top

      @SequentialOnly @IntermediateOp public abstract Stream<T> top(int n, Comparator<? super T> comparator)

      This method only runs sequentially, even in parallel stream.
      Parameters:
      n -
      comparator -
      Returns:
    • skipRange

      @SequentialOnly @IntermediateOp public abstract Stream<T> skipRange(int startInclusive, int endExclusive)
      Skip the range: [fromIndexInclusive, fromIndexInclusive].
      Parameters:
      startInclusive -
      endExclusive -
      Returns:
    • skipNull

      @Deprecated @SequentialOnly @IntermediateOp public abstract Stream<T> skipNull()
      Deprecated.
      Use skipNulls() instead
      Returns:
    • skipNulls

      @SequentialOnly @IntermediateOp public abstract Stream<T> skipNulls()
      Returns:
    • skipLast

      @SequentialOnly @IntermediateOp public abstract Stream<T> skipLast(int n)
      A queue with size up to n will be maintained to filter out the last n elements. It may cause out of memory error if n is big enough.
      This method only runs sequentially, even in parallel stream.
      Parameters:
      n -
      Returns:
    • last

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> last(int n)
      A queue with size up to n will be maintained to filter out the last n elements. It may cause out of memory error if n is big enough.
      All the elements will be loaded to get the last n elements and the Stream will be closed after that, if a terminal operation is triggered.
      Parameters:
      n -
      Returns:
    • rateLimited

      public Stream<T> rateLimited(RateLimiter rateLimiter)
      Parameters:
      rateLimiter -
      Returns:
      See Also:
    • delay

      public Stream<T> delay(Duration delay)
      Returns:
    • peekFirst

      @SequentialOnly @IntermediateOp public abstract Stream<T> peekFirst(Consumer<? super T> action)
      Parameters:
      action -
      Returns:
    • peekLast

      @SequentialOnly @IntermediateOp public abstract Stream<T> peekLast(Consumer<? super T> action)
      Parameters:
      action -
      Returns:
    • peekIf

      @Beta @IntermediateOp public Stream<T> peekIf(Predicate<? super T> predicate, Consumer<? super T> action)
      Parameters:
      predicate -
      action -
      Returns:
    • peekIf

      @Beta @IntermediateOp public Stream<T> peekIf(BiPredicate<? super T,? super Long> predicate, Consumer<? super T> action)
      Parameters:
      predicate - The first parameter is the element. The second parameter is the count of iterated elements, starts with 1.
      action -
      Returns:
    • forEach

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(Throwables.Consumer<? super T,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E
    • forEachIndexed

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IndexedConsumer<? super T,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E
    • forEachUntil

      @Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachUntil(Throwables.BiConsumer<? super T,MutableBoolean,E> action) throws E
      Iterate and execute action until the flag is set true. Flag can only be set after at least one element is iterated and executed by action.
      Type Parameters:
      E -
      Parameters:
      action - the second parameter is a flag to break the for-each loop. Set it to true to break the loop if you don't want to continue the action. Iteration on this stream will also be stopped when this flag is set to true.
      Throws:
      E
    • forEachUntil

      @Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachUntil(MutableBoolean flagToBreak, Throwables.Consumer<? super T,E> action) throws E
      Iterate and execute action until flagToBreak is set true. If flagToBreak is set to true at the begin, there will be no element iterated from stream before this stream is stopped and closed.
      Type Parameters:
      E -
      Parameters:
      flagToBreak - a flag to break the for-each loop. Set it to true to break the loop if you don't want to continue the action. Iteration on this stream will also be stopped when this flag is set to true.
      action -
      Throws:
      E
    • forEach

      @ParallelSupported @TerminalOp public abstract <E extends Exception, E2 extends Exception> void forEach(Throwables.Consumer<? super T,E> action, Throwables.Runnable<E2> onComplete) throws E, E2
      Type Parameters:
      E -
      E2 -
      Parameters:
      action -
      onComplete -
      Throws:
      E
      E2
    • forEach

      @ParallelSupported @TerminalOp public abstract <U, E extends Exception, E2 extends Exception> void forEach(Throwables.Function<? super T,? extends Collection<? extends U>,E> flatMapper, Throwables.BiConsumer<? super T,? super U,E2> action) throws E, E2
      Type Parameters:
      U -
      E -
      E2 -
      Parameters:
      flatMapper -
      action -
      Throws:
      E
      E2
    • forEach

      @ParallelSupported @TerminalOp public abstract <T2, T3, E extends Exception, E2 extends Exception, E3 extends Exception> void forEach(Throwables.Function<? super T,? extends Collection<T2>,E> flatMapper, Throwables.Function<? super T2,? extends Collection<T3>,E2> flatMapper2, Throwables.TriConsumer<? super T,? super T2,? super T3,E3> action) throws E, E2, E3
      Type Parameters:
      T2 -
      T3 -
      E -
      E2 -
      E3 -
      Parameters:
      flatMapper -
      flatMapper2 -
      action -
      Throws:
      E
      E2
      E3
    • forEachPair

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachPair(Throwables.BiConsumer<? super T,? super T,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E
    • forEachPair

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachPair(Throwables.BiConsumer<? super T,? super T,E> action, int increment) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      increment -
      Throws:
      E
    • forEachTriple

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachTriple(Throwables.TriConsumer<? super T,? super T,? super T,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E
    • forEachTriple

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachTriple(Throwables.TriConsumer<? super T,? super T,? super T,E> action, int increment) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      increment -
      Throws:
      E
    • anyMatch

      @ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(Throwables.Predicate<? super T,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E
    • allMatch

      @ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(Throwables.Predicate<? super T,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E
    • noneMatch

      @ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(Throwables.Predicate<? super T,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E
    • nMatch

      @ParallelSupported @TerminalOp public abstract <E extends Exception> boolean nMatch(long atLeast, long atMost, Throwables.Predicate<? super T,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      atLeast -
      atMost -
      predicate -
      Returns:
      Throws:
      E
    • findFirst

      @ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findFirst(Throwables.Predicate<? super T,E> predicate) throws E
      Returns the first element matched by predicateForFirst if found, Otherwise an empty Optional<T> will be returned.
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E
    • findLast

      @ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findLast(Throwables.Predicate<? super T,E> predicate) throws E
      Returns the last element matched by predicateForFirst if found, Otherwise an empty Optional<T> will be returned.
      Consider using: stream.reversed().findFirst(predicate) for better performance if possible.
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E
    • findAny

      @ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findAny(Throwables.Predicate<? super T,E> predicate) throws E
      Returns any element matched by predicateForFirst if found, Otherwise an empty Optional<T> will be returned. It's same as findFirst and always returns the first element matched by predicateForFirst if found in sequential stream. In parallel stream, it may have better performance than findFirst.
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E
    • findFirstOrAny

      @ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findFirstOrAny(Throwables.Predicate<? super T,E> predicateForFirst) throws E
      Returns the first element matched by predicateForFirst if found or the first element if this stream is not empty Otherwise an empty Optional<T> will be returned.
      Type Parameters:
      E -
      Parameters:
      predicateForFirst -
      Returns:
      Throws:
      E
    • findFirstOrAny

      @ParallelSupported @TerminalOp public abstract <E extends Exception, E2 extends Exception> u.Optional<T> findFirstOrAny(Throwables.Predicate<? super T,E> predicateForFirst, Throwables.Predicate<? super T,E2> predicateForAny) throws E, E2
      Returns the first element matched by predicateForFirst if found or any element matched by predicateForAny (If this is a sequential stream, it will always be the first element matched by predicateForAny). Otherwise an empty Optional<T> will be returned.
      Type Parameters:
      E -
      E2 -
      Parameters:
      predicateForFirst -
      predicateForAny -
      Returns:
      Throws:
      E
      E2
    • findFirstOrLast

      @ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findFirstOrLast(Throwables.Predicate<? super T,E> predicateForFirst) throws E
      Returns the first element matched by predicateForFirst if found or the last element if this stream is not empty Otherwise an empty Optional<T> will be returned.
      Type Parameters:
      E -
      Parameters:
      predicateForFirst -
      Returns:
      Throws:
      E
    • findFirstOrLast

      @Beta @SequentialOnly @TerminalOp public abstract <E extends Exception, E2 extends Exception> u.Optional<T> findFirstOrLast(Throwables.Predicate<? super T,E> predicateForFirst, Throwables.Predicate<? super T,E2> predicateForLast) throws E, E2
      Type Parameters:
      E -
      E2 -
      Parameters:
      predicateForFirst -
      predicateForLast -
      Returns:
      Throws:
      E
      E2
    • findFirstOrLast

      @Beta @SequentialOnly @TerminalOp public abstract <U, E extends Exception, E2 extends Exception> u.Optional<T> findFirstOrLast(U init, Throwables.BiPredicate<? super T,? super U,E> predicateForFirst, Throwables.BiPredicate<? super T,? super U,E2> predicateForLast) throws E, E2

      This method only runs sequentially, even in parallel stream.
      Type Parameters:
      U -
      E -
      E2 -
      Parameters:
      init -
      predicateForFirst -
      predicateForLast -
      Returns:
      Throws:
      E
      E2
    • findFirstOrLast

      @Beta @SequentialOnly @TerminalOp public abstract <U, E extends Exception, E2 extends Exception> u.Optional<T> findFirstOrLast(Function<? super T,U> preFunc, Throwables.BiPredicate<? super T,? super U,E> predicateForFirst, Throwables.BiPredicate<? super T,? super U,E2> predicateForLast) throws E, E2

      This method only runs sequentially, even in parallel stream.
      Type Parameters:
      U -
      E -
      E2 -
      Parameters:
      preFunc -
      predicateForFirst -
      predicateForLast -
      Returns:
      Throws:
      E
      E2
    • containsAll

      @SequentialOnly @TerminalOp public abstract boolean containsAll(T... a)
      Parameters:
      a -
      Returns:
    • containsAll

      @SequentialOnly @TerminalOp public abstract boolean containsAll(Collection<? extends T> c)
      Parameters:
      c -
      Returns:
    • containsAny

      @SequentialOnly @TerminalOp public abstract boolean containsAny(T... a)
      Parameters:
      a -
      Returns:
    • containsAny

      @SequentialOnly @TerminalOp public abstract boolean containsAny(Collection<? extends T> c)
      Parameters:
      c -
      Returns:
    • toArray

      @SequentialOnly @TerminalOp public abstract <A> A[] toArray(IntFunction<A[]> generator)
      Type Parameters:
      A -
      Parameters:
      generator -
      Returns:
    • toImmutableMap

      @ParallelSupported @TerminalOp public <K, V, E extends Exception, E2 extends Exception> ImmutableMap<K,V> toImmutableMap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E
      E2
      See Also:
    • toImmutableMap

      @ParallelSupported @TerminalOp public <K, V, E extends Exception, E2 extends Exception> ImmutableMap<K,V> toImmutableMap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
      Throws:
      E
      E2
      See Also:
    • toMap

      @ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K,V> toMap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E
      E2
      See Also:
    • toMap

      @ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K,V> toMap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, BinaryOperator<V> mergeFunction) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
      Throws:
      E
      E2
      See Also:
    • toMap

      @ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      M -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      Throws:
      E
      E2
      See Also:
    • toMap

      @ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, V>, E extends Exception, E2 extends Exception> M toMap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      M -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      mapFactory -
      Returns:
      Throws:
      E
      E2
      See Also:
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, E extends Exception> Map<K,List<T>> groupTo(Throwables.Function<? super T,? extends K,E> keyMapper) throws E
      Type Parameters:
      K -
      E -
      Parameters:
      keyMapper -
      Returns:
      Throws:
      E
      See Also:
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, M extends Map<K, List<T>>, E extends Exception> M groupTo(Throwables.Function<? super T,? extends K,E> keyMapper, Supplier<? extends M> mapFactory) throws E
      Type Parameters:
      K -
      M -
      E -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
      Throws:
      E
      See Also:
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K,List<V>> groupTo(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E
      E2
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, List<V>>, E extends Exception, E2 extends Exception> M groupTo(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      M -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      Throws:
      E
      E2
      See Also:
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K,D> groupTo(Throwables.Function<? super T,? extends K,E> keyMapper, Collector<? super T,?,D> downstream) throws E
      Type Parameters:
      K -
      D -
      E -
      Parameters:
      keyMapper -
      downstream -
      Returns:
      Throws:
      E
      See Also:
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M groupTo(Throwables.Function<? super T,? extends K,E> keyMapper, Collector<? super T,?,D> downstream, Supplier<? extends M> mapFactory) throws E
      Type Parameters:
      K -
      D -
      M -
      E -
      Parameters:
      keyMapper -
      downstream -
      mapFactory -
      Returns:
      Throws:
      E
      See Also:
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, V, D, E extends Exception, E2 extends Exception> Map<K,D> groupTo(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, Collector<? super V,?,D> downstream) throws E, E2
      Type Parameters:
      K -
      V -
      D -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      Returns:
      Throws:
      E
      E2
      See Also:
    • groupTo

      @ParallelSupported @TerminalOp public abstract <K, V, D, M extends Map<K, D>, E extends Exception, E2 extends Exception> M groupTo(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, Collector<? super V,?,D> downstream, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      D -
      M -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      mapFactory -
      Returns:
      Throws:
      E
      E2
      See Also:
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, E extends Exception> Map<K,List<T>> flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper) throws E
      Type Parameters:
      K -
      E -
      Parameters:
      flatKeyMapper -
      Returns:
      Throws:
      E
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, M extends Map<K, List<T>>, E extends Exception> M flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper, Supplier<? extends M> mapFactory) throws E
      Type Parameters:
      K -
      M -
      E -
      Parameters:
      flatKeyMapper -
      mapFactory -
      Returns:
      Throws:
      E
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> Map<K,List<V>> flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper, Throwables.BiFunction<? super K,? super T,? extends V,E2> valueMapper) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      flatKeyMapper -
      valueMapper -
      Returns:
      Throws:
      E
      E2
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, V, M extends Map<K, List<V>>, E extends Exception, E2 extends Exception> M flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper, Throwables.BiFunction<? super K,? super T,? extends V,E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      M -
      E -
      E2 -
      Parameters:
      flatKeyMapper -
      valueMapper -
      mapFactory -
      Returns:
      Throws:
      E
      E2
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, D, E extends Exception> Map<K,D> flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper, Collector<? super T,?,D> downstream) throws E
      Type Parameters:
      K -
      D -
      E -
      Parameters:
      flatKeyMapper -
      downstream -
      Returns:
      Throws:
      E
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, D, M extends Map<K, D>, E extends Exception> M flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper, Collector<? super T,?,D> downstream, Supplier<? extends M> mapFactory) throws E
      Type Parameters:
      K -
      D -
      M -
      E -
      Parameters:
      flatKeyMapper -
      downstream -
      mapFactory -
      Returns:
      Throws:
      E
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, V, D, E extends Exception, E2 extends Exception> Map<K,D> flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper, Throwables.BiFunction<? super K,? super T,? extends V,E2> valueMapper, Collector<? super V,?,D> downstream) throws E, E2
      Type Parameters:
      K -
      V -
      D -
      E -
      E2 -
      Parameters:
      flatKeyMapper -
      valueMapper -
      downstream -
      Returns:
      Throws:
      E
      E2
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, V, D, M extends Map<K, D>, E extends Exception, E2 extends Exception> M flatGroupTo(Throwables.Function<? super T,? extends Collection<? extends K>,E> flatKeyMapper, Throwables.BiFunction<? super K,? super T,? extends V,E2> valueMapper, Collector<? super V,?,D> downstream, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      D -
      M -
      E -
      E2 -
      Parameters:
      flatKeyMapper -
      valueMapper -
      downstream -
      mapFactory -
      Returns:
      Throws:
      E
      E2
    • partitionTo

      @ParallelSupported @TerminalOp public abstract <E extends Exception> Map<Boolean,List<T>> partitionTo(Throwables.Predicate<? super T,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E
      See Also:
    • partitionTo

      @ParallelSupported @TerminalOp public abstract <D, E extends Exception> Map<Boolean,D> partitionTo(Throwables.Predicate<? super T,E> predicate, Collector<? super T,?,D> downstream) throws E
      Type Parameters:
      D -
      E -
      Parameters:
      predicate -
      downstream -
      Returns:
      Throws:
      E
      See Also:
    • toMultimap

      @ParallelSupported @TerminalOp public abstract <K, E extends Exception> ListMultimap<K,T> toMultimap(Throwables.Function<? super T,? extends K,E> keyMapper) throws E
      Type Parameters:
      K -
      E -
      Parameters:
      keyMapper -
      Returns:
      Throws:
      E
      See Also:
    • toMultimap

      @ParallelSupported @TerminalOp public abstract <K, V extends Collection<T>, M extends Multimap<K, T, V>, E extends Exception> M toMultimap(Throwables.Function<? super T,? extends K,E> keyMapper, Supplier<? extends M> mapFactory) throws E
      Type Parameters:
      K -
      V -
      M -
      E -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
      Throws:
      E
      See Also:
    • toMultimap

      @ParallelSupported @TerminalOp public abstract <K, V, E extends Exception, E2 extends Exception> ListMultimap<K,V> toMultimap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E
      E2
      See Also:
    • toMultimap

      @ParallelSupported @TerminalOp public abstract <K, V, C extends Collection<V>, M extends Multimap<K, V, C>, E extends Exception, E2 extends Exception> M toMultimap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      C -
      M -
      E -
      E2 -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      Throws:
      E
      E2
      See Also:
    • toDataSet

      @SequentialOnly @TerminalOp public abstract DataSet toDataSet()
      The first row will be used as column names if its type is array or list, or obtain the column names from first row if its type is bean or map.
      Returns:
    • toDataSet

      @SequentialOnly @TerminalOp public abstract DataSet toDataSet(List<String> columnNames)
      If the specified columnNames is null or empty, the first row will be used as column names if its type is array or list, or obtain the column names from first row if its type is bean or map.
      Parameters:
      columnNames -
      Returns:
    • join

      @SequentialOnly @TerminalOp public abstract String join(Joiner joiner)
      Parameters:
      joiner -
      Returns:
    • foldLeft

      @SequentialOnly @TerminalOp public abstract <E extends Exception> u.Optional<T> foldLeft(Throwables.BinaryOperator<T,E> accumulator) throws E
      This method will always run sequentially, even in parallel stream.
      Type Parameters:
      E -
      Parameters:
      accumulator -
      Returns:
      Throws:
      E
      See Also:
      • #reduce(BinaryOperator)
    • foldLeft

      @SequentialOnly @TerminalOp public abstract <U, E extends Exception> U foldLeft(U identity, Throwables.BiFunction<U,? super T,U,E> accumulator) throws E
      This method will always run sequentially, even in parallel stream.
      Type Parameters:
      U -
      E -
      Parameters:
      identity -
      accumulator -
      Returns:
      Throws:
      E
      See Also:
      • #reduce(Object, BiFunction, BinaryOperator)
    • foldRight

      @SequentialOnly @TerminalOp public abstract <E extends Exception> u.Optional<T> foldRight(Throwables.BinaryOperator<T,E> accumulator) throws E
      This method will always run sequentially, even in parallel stream.
      Type Parameters:
      E -
      Parameters:
      accumulator -
      Returns:
      Throws:
      E
      See Also:
      • #reduce(BinaryOperator)
    • foldRight

      @SequentialOnly @TerminalOp public abstract <U, E extends Exception> U foldRight(U identity, Throwables.BiFunction<U,? super T,U,E> accumulator) throws E
      This method will always run sequentially, even in parallel stream.
      Type Parameters:
      U -
      E -
      Parameters:
      identity -
      accumulator -
      Returns:
      Throws:
      E
      See Also:
      • #reduce(Object, BiFunction, BinaryOperator)
    • reduce

      @ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> reduce(Throwables.BinaryOperator<T,E> accumulator) throws E
      Type Parameters:
      E -
      Parameters:
      accumulator -
      Returns:
      Throws:
      E
      See Also:
    • reduce

      @ParallelSupported @TerminalOp public <E extends Exception> T reduce(T identity, Throwables.BinaryOperator<T,E> accumulator) throws E
      Type Parameters:
      E -
      Parameters:
      identity -
      accumulator -
      Returns:
      Throws:
      E
      See Also:
    • reduce

      @ParallelSupported @TerminalOp public abstract <U, E extends Exception> U reduce(U identity, Throwables.BiFunction<U,? super T,U,E> accumulator, Throwables.BinaryOperator<U,E> combiner) throws E
      Type Parameters:
      U -
      E -
      Parameters:
      identity -
      accumulator -
      combiner -
      Returns:
      Throws:
      E
      See Also:
    • reduceUntil

      @Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> reduceUntil(Throwables.BinaryOperator<T,E> accumulator, Throwables.Predicate<? super T,E> conditionToBreak) throws E
      Type Parameters:
      E -
      Parameters:
      accumulator -
      conditionToBreak - the input parameter is the return value of accumulator, not the element from this Stream. Returns true to break the loop if you don't want to continue the action. Iteration on this stream will also be stopped when this flag is set to true.
      Returns:
      Throws:
      E
      See Also:
    • reduceUntil

      @Beta @ParallelSupported @TerminalOp public <E extends Exception> T reduceUntil(T identity, Throwables.BinaryOperator<T,E> accumulator, Throwables.Predicate<? super T,E> conditionToBreak) throws E
      Type Parameters:
      E -
      Parameters:
      identity -
      accumulator -
      conditionToBreak - the input parameter is the return value of accumulator, not the element from this Stream. Returns true to break the loop if you don't want to continue the action. Iteration on this stream will also be stopped when this flag is set to true.
      Returns:
      Throws:
      E
      See Also:
    • reduceUntil

      @Beta @ParallelSupported @TerminalOp public abstract <U, E extends Exception> U reduceUntil(U identity, Throwables.BiFunction<U,? super T,U,E> accumulator, Throwables.BinaryOperator<U,E> combiner, Throwables.Predicate<? super U,E> conditionToBreak) throws E
      Type Parameters:
      U -
      E -
      Parameters:
      identity -
      accumulator -
      combiner -
      conditionToBreak - the input parameter is the return value of accumulator, not the element from this Stream. Returns true to break the loop if you don't want to continue the action. Iteration on this stream will also be stopped when this flag is set to true.
      Returns:
      Throws:
      E
      See Also:
    • collect

      @ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, BiConsumer<? super R,? super T> accumulator, BiConsumer<R,R> combiner)
      Type Parameters:
      R - if R is Map/Collection/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList, It's not required to specified combiner. Otherwise, combiner must be specified.
      Parameters:
      supplier -
      accumulator -
      combiner -
      Returns:
      See Also:
    • collect

      @ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, BiConsumer<? super R,? super T> accumulator)
      Only call this method when the returned type R is one types: Collection/Map/StringBuilder/Multiset/LongMultiset/Multimap/BooleanList/IntList/.../DoubleList. Otherwise, please call collect(Supplier, BiConsumer, BiConsumer).
      Type Parameters:
      R -
      Parameters:
      supplier -
      accumulator -
      Returns:
      See Also:
    • collect

      @ParallelSupported @TerminalOp public abstract <R> R collect(Collector<? super T,?,R> collector)
      Type Parameters:
      R -
      Parameters:
      collector -
      Returns:
    • collectAndThen

      @ParallelSupported @TerminalOp public abstract <R, RR, E extends Exception> RR collectAndThen(Collector<? super T,?,R> downstream, Throwables.Function<? super R,? extends RR,E> func) throws E
      Type Parameters:
      R -
      RR -
      E -
      Parameters:
      downstream -
      func -
      Returns:
      Throws:
      E
    • toListAndThen

      @SequentialOnly @TerminalOp public abstract <R, E extends Exception> R toListAndThen(Throwables.Function<? super List<T>,? extends R,E> func) throws E
      Type Parameters:
      R -
      E -
      Parameters:
      func -
      Returns:
      Throws:
      E
    • toSetAndThen

      @SequentialOnly @TerminalOp public abstract <R, E extends Exception> R toSetAndThen(Throwables.Function<? super Set<T>,? extends R,E> func) throws E
      Type Parameters:
      R -
      E -
      Parameters:
      func -
      Returns:
      Throws:
      E
    • toCollectionAndThen

      @SequentialOnly @TerminalOp public abstract <R, CC extends Collection<T>, E extends Exception> R toCollectionAndThen(Supplier<? extends CC> supplier, Throwables.Function<? super CC,? extends R,E> func) throws E
      Type Parameters:
      R -
      CC -
      E -
      Parameters:
      supplier -
      func -
      Returns:
      Throws:
      E
    • min

      @ParallelSupported @TerminalOp public abstract u.Optional<T> min(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • minBy

      @ParallelSupported @TerminalOp public u.Optional<T> minBy(Function<? super T,? extends Comparable> keyMapper)
      Parameters:
      keyMapper -
      Returns:
    • minAll

      @ParallelSupported @TerminalOp public abstract List<T> minAll(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • max

      @ParallelSupported @TerminalOp public abstract u.Optional<T> max(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • maxBy

      @ParallelSupported @TerminalOp public u.Optional<T> maxBy(Function<? super T,? extends Comparable> keyMapper)
      Parameters:
      keyMapper -
      Returns:
    • maxAll

      @ParallelSupported @TerminalOp public abstract List<T> maxAll(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • kthLargest

      @ParallelSupported @TerminalOp public abstract u.Optional<T> kthLargest(int k, Comparator<? super T> comparator)
      Parameters:
      k -
      comparator -
      Returns:
      Optional.empty() if there is no element or count less than k, otherwise the kth largest element.
    • sumInt

      @ParallelSupported @TerminalOp public abstract long sumInt(ToIntFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • sumLong

      @ParallelSupported @TerminalOp public abstract long sumLong(ToLongFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • sumDouble

      @ParallelSupported @TerminalOp public abstract double sumDouble(ToDoubleFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • averageInt

      @ParallelSupported @TerminalOp public abstract u.OptionalDouble averageInt(ToIntFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • averageLong

      @ParallelSupported @TerminalOp public abstract u.OptionalDouble averageLong(ToLongFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • averageDouble

      @ParallelSupported @TerminalOp public abstract u.OptionalDouble averageDouble(ToDoubleFunction<? super T> mapper)
      Parameters:
      mapper -
      Returns:
    • percentiles

      @SequentialOnly @TerminalOp public abstract u.Optional<Map<Percentage,T>> percentiles(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • hasDuplicates

      @SequentialOnly @TerminalOp public abstract boolean hasDuplicates()
      Returns:
    • combinations

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations()
       
       Stream.of(1, 2, 3).combinations().forEach(Fn.println());
       // output
       []
       [1]
       [2]
       [3]
       [1, 2]
       [1, 3]
       [2, 3]
       [1, 2, 3]
       
       
      Returns:
    • combinations

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations(int len)
       
       Stream.of(1, 2, 3).combinations(2).forEach(Fn.println());
       // output
       [1, 2]
       [1, 3]
       [2, 3]
       
       
      Parameters:
      len -
      Returns:
    • combinations

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations(int len, boolean repeat)
      It's same as N.cartesianProduct(N.repeat(toList(), len)) if repeat is true.
       
       Stream.of(1, 2, 3).combinations(2, true).forEach(Fn.println());
       // output
       [1, 1]
       [1, 2]
       [1, 3]
       [2, 1]
       [2, 2]
       [2, 3]
       [3, 1]
       [3, 2]
       [3, 3]
       
       
      Parameters:
      len -
      repeat -
      Returns:
    • permutations

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> permutations()
       
       Stream.of(1, 2, 3).permutations().forEach(Fn.println());
       // output
       [1, 2, 3]
       [1, 3, 2]
       [3, 1, 2]
       [3, 2, 1]
       [2, 3, 1]
       [2, 1, 3]
       
       
      Returns:
    • orderedPermutations

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> orderedPermutations()
       
       Stream.of(1, 2, 3).orderedPermutations().forEach(Fn.println());
       // output
       [1, 2, 3]
       [1, 3, 2]
       [2, 1, 3]
       [2, 3, 1]
       [3, 1, 2]
       [3, 2, 1]
       
       
      Returns:
    • orderedPermutations

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> orderedPermutations(Comparator<? super T> comparator)
      Parameters:
      comparator -
      Returns:
    • cartesianProduct

      @SequentialOnly @IntermediateOp @SafeVarargs public final Stream<List<T>> cartesianProduct(Collection<? extends T>... cs)
      Parameters:
      cs -
      Returns:
    • cartesianProduct

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> cartesianProduct(Collection<? extends Collection<? extends T>> cs)
      Parameters:
      cs -
      Returns:
    • intersection

      @ParallelSupported @IntermediateOp public abstract <U> Stream<T> intersection(Function<? super T,? extends U> mapper, Collection<U> c)
      Intersect with the specified Collection by the values mapped by mapper.
      Type Parameters:
      U -
      Parameters:
      mapper -
      c -
      Returns:
      See Also:
    • difference

      @ParallelSupported @IntermediateOp public abstract <U> Stream<T> difference(Function<? super T,? extends U> mapper, Collection<U> c)
      Except with the specified Collection by the values mapped by mapper.
      Type Parameters:
      U -
      Parameters:
      mapper -
      c -
      Returns:
      See Also:
    • defaultIfEmpty

      @SequentialOnly @IntermediateOp public final Stream<T> defaultIfEmpty(T defaultValue)
      Parameters:
      defaultValue -
      Returns:
      See Also:
    • defaultIfEmpty

      @SequentialOnly @IntermediateOp public final Stream<T> defaultIfEmpty(Supplier<? extends Stream<T>> supplier)
      Parameters:
      supplier -
      Returns:
      See Also:
    • prepend

      @SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> prepend(T... a)
      Parameters:
      a -
      Returns:
    • prepend

      @SequentialOnly @IntermediateOp public abstract Stream<T> prepend(Collection<? extends T> c)
      Parameters:
      c -
      Returns:
    • append

      @SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> append(T... a)
      Parameters:
      a -
      Returns:
    • append

      @SequentialOnly @IntermediateOp public abstract Stream<T> append(Collection<? extends T> c)
      Parameters:
      c -
      Returns:
    • appendIfEmpty

      @SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> appendIfEmpty(T... a)
      Parameters:
      a -
      Returns:
    • appendIfEmpty

      @SequentialOnly @IntermediateOp public abstract Stream<T> appendIfEmpty(Collection<? extends T> c)
      Parameters:
      c -
      Returns:
    • rollup

      Returns:
    • buffered

      @SequentialOnly @IntermediateOp public abstract Stream<T> buffered()
      Returns a new Stream with elements from a temporary queue which is filled by reading the elements from this Stream asynchronously with a new thread. Default queue size is 64.
      Mostly it's for read-write with different threads mode.
      Returns:
      See Also:
    • buffered

      @SequentialOnly @IntermediateOp public abstract Stream<T> buffered(int bufferSize)
      Returns a new Stream with elements from a temporary queue which is filled by reading the elements from this Stream asynchronously with a new thread.
      Mostly it's for read-write with different threads mode.
      Parameters:
      bufferSize -
      Returns:
      See Also:
    • mergeWith

      @SequentialOnly @IntermediateOp public abstract Stream<T> mergeWith(Collection<? extends T> b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Parameters:
      b -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • mergeWith

      @SequentialOnly @IntermediateOp public abstract Stream<T> mergeWith(Stream<? extends T> b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Parameters:
      b -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(Collection<T2> b, BiFunction<? super T,? super T2,? extends R> zipFunction)
      Type Parameters:
      T2 -
      R -
      Parameters:
      b -
      zipFunction -
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(Collection<T2> b, T valueForNoneA, T2 valueForNoneB, BiFunction<? super T,? super T2,? extends R> zipFunction)
      Type Parameters:
      T2 -
      R -
      Parameters:
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Collection<T2> b, Collection<T3> c, TriFunction<? super T,? super T2,? super T3,? extends R> zipFunction)
      Type Parameters:
      T2 -
      T3 -
      R -
      Parameters:
      b -
      c -
      zipFunction -
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Collection<T2> b, Collection<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, TriFunction<? super T,? super T2,? super T3,? extends R> zipFunction)
      Type Parameters:
      T2 -
      T3 -
      R -
      Parameters:
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(Stream<T2> b, BiFunction<? super T,? super T2,? extends R> zipFunction)
      Type Parameters:
      T2 -
      R -
      Parameters:
      b -
      zipFunction -
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(Stream<T2> b, T valueForNoneA, T2 valueForNoneB, BiFunction<? super T,? super T2,? extends R> zipFunction)
      Type Parameters:
      T2 -
      R -
      Parameters:
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Stream<T2> b, Stream<T3> c, TriFunction<? super T,? super T2,? super T3,? extends R> zipFunction)
      Type Parameters:
      T2 -
      T3 -
      R -
      Parameters:
      b -
      c -
      zipFunction -
      Returns:
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Stream<T2> b, Stream<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, TriFunction<? super T,? super T2,? super T3,? extends R> zipFunction)
      Type Parameters:
      T2 -
      T3 -
      R -
      Parameters:
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      Returns:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(File file)
      Parameters:
      file -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Function<? super T,String> toLine, File file)
      Parameters:
      toLine -
      file -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Function<? super T,String> toLine, OutputStream os)
      Parameters:
      toLine -
      os -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Function<? super T,String> toLine, Writer writer)
      Parameters:
      toLine -
      writer -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Throwables.BiConsumer<? super T,Writer,IOException> writeLine, File file)
      Parameters:
      writeLine -
      file -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Throwables.BiConsumer<? super T,Writer,IOException> writeLine, Writer writer)
      Parameters:
      writeLine -
      writer -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(PreparedStatement stmt, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter)
      To support batch call, please use onEach or onEachE.
      Parameters:
      stmt -
      stmtSetter -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(Connection conn, String insertSQL, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter)
      To support batch call, please use onEach or onEachE.
      Parameters:
      conn -
      insertSQL -
      stmtSetter -
      Returns:
      See Also:
    • saveEach

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> saveEach(DataSource ds, String insertSQL, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter)
      To support batch/parallel call, please use onEach or onEachE.
      Parameters:
      ds -
      insertSQL -
      stmtSetter -
      Returns:
      See Also:
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(File file) throws IOException
      Parameters:
      file -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(String header, String tail, File file) throws IOException
      Parameters:
      header -
      tail -
      file -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Function<? super T,String> toLine, File file) throws IOException
      Parameters:
      toLine -
      file -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Function<? super T,String> toLine, String header, String tail, File file) throws IOException
      Parameters:
      toLine -
      header -
      tail -
      file -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Function<? super T,String> toLine, OutputStream os) throws IOException
      Parameters:
      toLine -
      os -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Function<? super T,String> toLine, Writer writer) throws IOException
      Parameters:
      toLine -
      writer -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Function<? super T,String> toLine, String header, String tail, Writer writer) throws IOException
      Parameters:
      toLine -
      header -
      tail -
      writer -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Throwables.BiConsumer<? super T,Writer,IOException> writeLine, File file) throws IOException
      Parameters:
      writeLine -
      file -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Throwables.BiConsumer<? super T,Writer,IOException> writeLine, String header, String tail, File file) throws IOException
      Parameters:
      writeLine -
      header -
      tail -
      file -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Throwables.BiConsumer<? super T,Writer,IOException> writeLine, Writer writer) throws IOException
      Parameters:
      writeLine -
      writer -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Throwables.BiConsumer<? super T,Writer,IOException> writeLine, String header, String tail, Writer writer) throws IOException
      Parameters:
      writeLine -
      header -
      tail -
      writer -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(PreparedStatement stmt, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter) throws SQLException
      Parameters:
      stmt -
      batchSize -
      batchIntervalInMillis -
      stmtSetter -
      Returns:
      Throws:
      SQLException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter) throws SQLException
      Parameters:
      conn -
      insertSQL -
      batchSize -
      batchIntervalInMillis -
      stmtSetter -
      Returns:
      Throws:
      SQLException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(DataSource ds, String insertSQL, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter) throws SQLException
      Parameters:
      ds -
      insertSQL -
      batchSize -
      batchIntervalInMillis -
      stmtSetter -
      Returns:
      Throws:
      SQLException
    • persistToCSV

      @SequentialOnly @TerminalOp public abstract long persistToCSV(File file) throws IOException
      Each line in the output file/Writer is an array of JSON String without root bracket.
      Parameters:
      file -
      Returns:
      Throws:
      IOException
    • persistToCSV

      @SequentialOnly @TerminalOp public abstract long persistToCSV(Collection<String> csvHeaders, File file) throws IOException
      Each line in the output file/Writer is an array of JSON String without root bracket.
      Parameters:
      csvHeaders -
      file -
      Returns:
      Throws:
      IOException
    • persistToCSV

      @SequentialOnly @TerminalOp public abstract long persistToCSV(OutputStream os) throws IOException
      Each line in the output file/Writer is an array of JSON String without root bracket.
      Parameters:
      os -
      Returns:
      Throws:
      IOException
    • persistToCSV

      @SequentialOnly @TerminalOp public abstract long persistToCSV(Collection<String> csvHeaders, OutputStream os) throws IOException
      Each line in the output file/Writer is an array of JSON String without root bracket.
      Parameters:
      csvHeaders -
      os -
      Returns:
      Throws:
      IOException
    • persistToCSV

      @SequentialOnly @TerminalOp public abstract long persistToCSV(Writer writer) throws IOException
      Each line in the output file/Writer is an array of JSON String without root bracket.
      Parameters:
      writer -
      Returns:
      Throws:
      IOException
    • persistToCSV

      @SequentialOnly @TerminalOp public abstract long persistToCSV(Collection<String> csvHeaders, Writer writer) throws IOException
      Each line in the output file/Writer is an array of JSON String without root bracket.
      Parameters:
      csvHeaders -
      writer -
      Returns:
      Throws:
      IOException
    • toJdkStream

      @SequentialOnly @IntermediateOp public abstract Stream<T> toJdkStream()
      Remember to close this Stream after the iteration is done, if needed.
      Returns:
    • checked

      Type Parameters:
      E -
      Returns:
    • checked

      @Beta @SequentialOnly @IntermediateOp public <E extends Exception> ExceptionalStream<T,E> checked(Class<E> exceptionType)
      Type Parameters:
      E -
      Parameters:
      exceptionType -
      Returns:
    • iterator

      @SequentialOnly public ObjIterator<T> iterator()
      Remember to close this Stream after the iteration is done, if needed.
      Returns:
    • sps

      @Beta @IntermediateOp public <R> Stream<R> sps(int maxThreadNum, int bufferSize, Function<? super Stream<T>,? extends Stream<? extends R>> op)
      Temporarily switch the stream to parallel stream for operation op and then switch back to sequence stream.
      split(bufferSize).flatMap(s -> op.apply(s)).sequential()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      bufferSize -
      op -
      Returns:
    • spsFilter

      @Beta @IntermediateOp public Stream<T> spsFilter(Predicate<? super T> predicate)
      Temporarily switch the stream to parallel stream for operation filter and then switch back to sequence stream.
      stream().parallel().filter(predicate).sequence()
      Parameters:
      predicate -
      Returns:
      See Also:
    • spsMap

      @Beta @IntermediateOp public <R> Stream<R> spsMap(Function<? super T,? extends R> mapper)
      Temporarily switch the stream to parallel stream for operation map and then switch back to sequence stream.
      stream().parallel().map(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • spsFlatMap

      @Beta @IntermediateOp public <R> Stream<R> spsFlatMap(Function<? super T,? extends Stream<? extends R>> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel().flatMap(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • spsFlatmap

      @Beta @IntermediateOp public <R> Stream<R> spsFlatmap(Function<? super T,? extends Collection<? extends R>> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel().flatmap(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • spsOnEach

      @Beta @IntermediateOp public Stream<T> spsOnEach(Consumer<? super T> action)
      Temporarily switch the stream to parallel stream for operation onEach and then switch back to sequence stream.
      stream().parallel().onEach(action).sequence()
      Parameters:
      action -
      Returns:
      See Also:
    • spsFilter

      @Beta @IntermediateOp public Stream<T> spsFilter(int maxThreadNum, Predicate<? super T> predicate)
      Temporarily switch the stream to parallel stream for operation filter and then switch back to sequence stream.
      stream().parallel(maxThreadNum).filter(predicate).sequence()
      Parameters:
      maxThreadNum -
      predicate -
      Returns:
      See Also:
    • spsMap

      @Beta @IntermediateOp public <R> Stream<R> spsMap(int maxThreadNum, Function<? super T,? extends R> mapper)
      Temporarily switch the stream to parallel stream for operation map and then switch back to sequence stream.
      stream().parallel(maxThreadNum).map(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      mapper -
      Returns:
      See Also:
    • spsFlatMap

      @Beta @IntermediateOp public <R> Stream<R> spsFlatMap(int maxThreadNum, Function<? super T,? extends Stream<? extends R>> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel(maxThreadNum).flatMap(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      mapper -
      Returns:
      See Also:
    • spsFlatmap

      @Beta @IntermediateOp public <R> Stream<R> spsFlatmap(int maxThreadNum, Function<? super T,? extends Collection<? extends R>> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel(maxThreadNum).flatmap(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      mapper -
      Returns:
      See Also:
    • spsOnEach

      @Beta @IntermediateOp public Stream<T> spsOnEach(int maxThreadNum, Consumer<? super T> action)
      Temporarily switch the stream to parallel stream for operation onEach and then switch back to sequence stream.
      stream().parallel(maxThreadNum).onEach(action).sequence()
      Parameters:
      maxThreadNum -
      action -
      Returns:
      See Also:
    • spsFilter

      @Beta @IntermediateOp public Stream<T> spsFilter(int maxThreadNum, int bufferSize, Predicate<? super T> predicate)
      Temporarily switch the stream to parallel stream for operation filter and then switch back to sequence stream.
      split(bufferSize).flatMap(s -> s.filter(predicate)).sequential()
      Parameters:
      maxThreadNum -
      bufferSize -
      predicate -
      Returns:
      See Also:
    • spsMap

      @Beta @IntermediateOp public <R> Stream<R> spsMap(int maxThreadNum, int bufferSize, Function<? super T,? extends R> mapper)
      Temporarily switch the stream to parallel stream for operation map and then switch back to sequence stream.
      split(bufferSize).flatMap(s -> s.map(mapper)).sequential()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      bufferSize -
      mapper -
      Returns:
      See Also:
    • spsFlatMap

      @Beta @IntermediateOp public <R> Stream<R> spsFlatMap(int maxThreadNum, int bufferSize, Function<? super T,? extends Stream<? extends R>> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      split(bufferSize).flatMap(s -> s.flatMap(mapper)).sequential()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      bufferSize -
      mapper -
      Returns:
      See Also:
    • spsFlatmap

      @Beta @IntermediateOp public <R> Stream<R> spsFlatmap(int maxThreadNum, int bufferSize, Function<? super T,? extends Collection<? extends R>> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      split(bufferSize).flatMap(s -> s.flatmap(mapper)).sequential()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      bufferSize -
      mapper -
      Returns:
      See Also:
    • spsOnEach

      @Beta @IntermediateOp public Stream<T> spsOnEach(int maxThreadNum, int bufferSize, Consumer<? super T> action)
      Temporarily switch the stream to parallel stream for operation onEach and then switch back to sequence stream.
      split(bufferSize).flatMap(s -> s.onEach(action)).sequential()
      Parameters:
      maxThreadNum -
      bufferSize -
      action -
      Returns:
      See Also:
    • spsFilterE

      @Beta @IntermediateOp public Stream<T> spsFilterE(Throwables.Predicate<? super T,? extends Exception> predicate)
      Temporarily switch the stream to parallel stream for operation filter and then switch back to sequence stream.
      stream().parallel().filterE(predicate).sequence()
      Parameters:
      predicate -
      Returns:
      See Also:
    • spsMapE

      @Beta @IntermediateOp public <R> Stream<R> spsMapE(Throwables.Function<? super T,? extends R,? extends Exception> mapper)
      Temporarily switch the stream to parallel stream for operation map and then switch back to sequence stream.
      stream().parallel().mapE(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • spsFlatMapE

      @Beta @IntermediateOp public <R> Stream<R> spsFlatMapE(Throwables.Function<? super T,? extends Stream<? extends R>,? extends Exception> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel().flatMapE(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • spsFlatmapE

      @Beta @IntermediateOp public <R> Stream<R> spsFlatmapE(Throwables.Function<? super T,? extends Collection<? extends R>,? extends Exception> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel().flatmapE(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • spsOnEachE

      @Beta @IntermediateOp public Stream<T> spsOnEachE(Throwables.Consumer<? super T,? extends Exception> action)
      Temporarily switch the stream to parallel stream for operation onEach and then switch back to sequence stream.
      stream().parallel().onEachE(action).sequence()
      Parameters:
      action -
      Returns:
      See Also:
    • spsFilterE

      @Beta @IntermediateOp public Stream<T> spsFilterE(int maxThreadNum, Throwables.Predicate<? super T,? extends Exception> predicate)
      Temporarily switch the stream to parallel stream for operation filter and then switch back to sequence stream.
      stream().parallel().filterE(predicate).sequence()
      Parameters:
      maxThreadNum -
      predicate -
      Returns:
      See Also:
    • spsMapE

      @Beta @IntermediateOp public <R> Stream<R> spsMapE(int maxThreadNum, Throwables.Function<? super T,? extends R,? extends Exception> mapper)
      Temporarily switch the stream to parallel stream for operation map and then switch back to sequence stream.
      stream().parallel().mapE(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      mapper -
      Returns:
      See Also:
    • spsFlatMapE

      @Beta @IntermediateOp public <R> Stream<R> spsFlatMapE(int maxThreadNum, Throwables.Function<? super T,? extends Stream<? extends R>,? extends Exception> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel().flatMapE(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      mapper -
      Returns:
      See Also:
    • spsFlatmapE

      @Beta @IntermediateOp public <R> Stream<R> spsFlatmapE(int maxThreadNum, Throwables.Function<? super T,? extends Collection<? extends R>,? extends Exception> mapper)
      Temporarily switch the stream to parallel stream for operation flatMap and then switch back to sequence stream.
      stream().parallel().flatmapE(mapper).sequence()
      Type Parameters:
      R -
      Parameters:
      maxThreadNum -
      mapper -
      Returns:
      See Also:
    • spsOnEachE

      @Beta @IntermediateOp public Stream<T> spsOnEachE(int maxThreadNum, Throwables.Consumer<? super T,? extends Exception> action)
      Temporarily switch the stream to parallel stream for operation onEach and then switch back to sequence stream.
      stream().parallel().onEachE(action).sequence()
      Parameters:
      maxThreadNum -
      action -
      Returns:
      See Also:
    • sjps

      @Beta @IntermediateOp public <R> Stream<R> sjps(Function<? super Stream<T>,? extends Stream<? extends R>> op)
      Temporarily switch the stream to Jdk parallel stream for operation ops and then switch back to sequence stream.
      stream.(switchToJdkStream).parallel().ops(map/filter/...).(switchBack).sequence()
      Type Parameters:
      R -
      Parameters:
      op -
      Returns:
    • filterE

      @Beta @ParallelSupported @IntermediateOp public Stream<T> filterE(Throwables.Predicate<? super T,? extends Exception> predicate)
      Parameters:
      predicate -
      Returns:
      See Also:
    • mapE

      @Beta @ParallelSupported @IntermediateOp public <R> Stream<R> mapE(Throwables.Function<? super T,? extends R,? extends Exception> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • flatMapE

      @Beta @ParallelSupported @IntermediateOp public <R> Stream<R> flatMapE(Throwables.Function<? super T,? extends Stream<? extends R>,? extends Exception> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • flatmapE

      @Beta @ParallelSupported @IntermediateOp public <R> Stream<R> flatmapE(Throwables.Function<? super T,? extends Collection<? extends R>,? extends Exception> mapper)
      Type Parameters:
      R -
      Parameters:
      mapper -
      Returns:
      See Also:
    • onEachE

      @Beta @ParallelSupported @IntermediateOp public Stream<T> onEachE(Throwables.Consumer<? super T,? extends Exception> action)
      Parameters:
      action -
      Returns:
      See Also:
    • saveOnEachE

      @Beta @ParallelSupported @IntermediateOp public Stream<T> saveOnEachE(Throwables.Consumer<? super T,? extends Exception> action)
      Parameters:
      action -
      Returns:
      See Also:
    • mapToDisposableEntry

      @Beta @SequentialOnly @Deprecated public <K, V> Stream<NoCachingNoUpdating.DisposableEntry<K,V>> mapToDisposableEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Deprecated.
      To reduce the memory footprint, Only one instance of DisposableEntry is created, and the same entry instance is returned and set with different keys/values during iteration of the returned stream. The elements only can be retrieved one by one, can't be modified or saved. The returned Stream doesn't support the operations which require two or more elements at the same time: (e.g. sort/distinct/pairMap/slidingMap/sliding/split/toList/toSet/...). , and can't be parallel stream. Operations: filter/map/toMap/groupBy/groupTo/... are supported.
      Type Parameters:
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      See Also:
    • asyncRun

      @Beta @TerminalOp public ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super Stream<T>,? extends Exception> terminalAction)
      Parameters:
      terminalAction - a terminal operation should be called.
      Returns:
    • asyncRun

      @Beta @TerminalOp public ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super Stream<T>,? extends Exception> terminalAction, Executor executor)
      Parameters:
      terminalAction - a terminal operation should be called.
      executor -
      Returns:
    • asyncCall

      @Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(Throwables.Function<? super Stream<T>,R,? extends Exception> terminalAction)
      Type Parameters:
      R -
      Parameters:
      terminalAction - a terminal operation should be called.
      Returns:
    • asyncCall

      @Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(Throwables.Function<? super Stream<T>,R,? extends Exception> terminalAction, Executor executor)
      Type Parameters:
      R -
      Parameters:
      terminalAction - a terminal operation should be called.
      executor -
      Returns:
    • empty

      public static <T> Stream<T> empty()
      Type Parameters:
      T -
      Returns:
    • just

      public static <T> Stream<T> just(T e)
      Type Parameters:
      T -
      Parameters:
      e -
      Returns:
    • ofNullable

      public static <T> Stream<T> ofNullable(T e)
      Returns an empty Stream if the specified t is null.
      Type Parameters:
      T -
      Parameters:
      e -
      Returns:
    • of

      @SafeVarargs public static <T> Stream<T> of(T... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • of

      public static <T> Stream<T> of(T[] a, int startIndex, int endIndex)
      Type Parameters:
      T -
      Parameters:
      a -
      startIndex -
      endIndex -
      Returns:
    • of

      public static <T> Stream<T> of(Collection<? extends T> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • of

      public static <T> Stream<T> of(Collection<? extends T> c, int startIndex, int endIndex)
      Type Parameters:
      T -
      Parameters:
      c -
      startIndex -
      endIndex -
      Returns:
    • of

      public static <K, V> Stream<Map.Entry<K,V>> of(Map<? extends K,? extends V> map)
      Type Parameters:
      K -
      V -
      Parameters:
      map -
      Returns:
    • of

      public static <T> Stream<T> of(Iterable<? extends T> iterable)
      Type Parameters:
      T -
      Parameters:
      iterable -
      Returns:
    • of

      public static <T> Stream<T> of(Iterator<? extends T> iterator)
      Type Parameters:
      T -
      Parameters:
      iterator -
      Returns:
    • of

      public static <T> Stream<T> of(Stream<? extends T> stream)
      Type Parameters:
      T -
      Parameters:
      stream -
      Returns:
    • of

      public static <T> Stream<T> of(Enumeration<? extends T> enumeration)
      Type Parameters:
      T -
      Parameters:
      enumeration -
      Returns:
    • of

      public static Stream<Boolean> of(boolean[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Boolean> of(boolean[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static Stream<Character> of(char[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Character> of(char[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static Stream<Byte> of(byte[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Byte> of(byte[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static Stream<Short> of(short[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Short> of(short[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static Stream<Integer> of(int[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Integer> of(int[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static Stream<Long> of(long[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Long> of(long[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static Stream<Float> of(float[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Float> of(float[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static Stream<Double> of(double[] a)
      Parameters:
      a -
      Returns:
    • of

      public static Stream<Double> of(double[] a, int fromIndex, int toIndex)
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static <T> Stream<T> of(u.Optional<T> op)
      Type Parameters:
      T -
      Parameters:
      op -
      Returns:
    • of

      public static <T> Stream<T> of(Optional<T> op)
      Type Parameters:
      T -
      Parameters:
      op -
      Returns:
    • ofKeys

      public static <K> Stream<K> ofKeys(Map<? extends K,?> map)
      Type Parameters:
      K -
      Parameters:
      map -
      Returns:
    • ofKeys

      public static <K, V> Stream<K> ofKeys(Map<? extends K,? extends V> map, Predicate<? super V> valueFilter)
      Type Parameters:
      K -
      V -
      Parameters:
      map -
      valueFilter -
      Returns:
    • ofKeys

      public static <K, V> Stream<K> ofKeys(Map<? extends K,? extends V> map, BiPredicate<? super K,? super V> filter)
      Type Parameters:
      K -
      V -
      Parameters:
      map -
      filter -
      Returns:
    • ofValues

      public static <V> Stream<V> ofValues(Map<?,? extends V> map)
      Type Parameters:
      V -
      Parameters:
      map -
      Returns:
    • ofValues

      public static <K, V> Stream<V> ofValues(Map<? extends K,? extends V> map, Predicate<? super K> keyFilter)
      Type Parameters:
      K -
      V -
      Parameters:
      map -
      keyFilter -
      Returns:
    • ofValues

      public static <K, V> Stream<V> ofValues(Map<? extends K,? extends V> map, BiPredicate<? super K,? super V> filter)
      Type Parameters:
      K -
      V -
      Parameters:
      map -
      filter -
      Returns:
    • defer

      public static <T> Stream<T> defer(Supplier<? extends Stream<T>> supplier)
      Lazy evaluation.
      This is equal to: Stream.just(supplier).flatMap(it -> it.get()).
      Type Parameters:
      T -
      Parameters:
      supplier -
      Returns:
    • range

      public static Stream<Integer> range(int startInclusive, int endExclusive)
      Parameters:
      startInclusive -
      endExclusive -
      Returns:
    • range

      public static Stream<Integer> range(int startInclusive, int endExclusive, int by)
      Parameters:
      startInclusive -
      endExclusive -
      by -
      Returns:
    • range

      public static Stream<Long> range(long startInclusive, long endExclusive)
      Parameters:
      startInclusive -
      endExclusive -
      Returns:
    • range

      public static Stream<Long> range(long startInclusive, long endExclusive, long by)
      Parameters:
      startInclusive -
      endExclusive -
      by -
      Returns:
    • rangeClosed

      public static Stream<Integer> rangeClosed(int startInclusive, int endInclusive)
      Parameters:
      startInclusive -
      endInclusive -
      Returns:
    • rangeClosed

      public static Stream<Integer> rangeClosed(int startInclusive, int endInclusive, int by)
      Parameters:
      startInclusive -
      endInclusive -
      by -
      Returns:
    • rangeClosed

      public static Stream<Long> rangeClosed(long startInclusive, long endInclusive)
      Parameters:
      startInclusive -
      endInclusive -
      Returns:
    • rangeClosed

      public static Stream<Long> rangeClosed(long startInclusive, long endInclusive, long by)
      Parameters:
      startInclusive -
      endInclusive -
      by -
      Returns:
    • split

      public static Stream<String> split(CharSequence str, CharSequence delimiter)
      Parameters:
      str -
      delimiter -
      Returns:
    • flatten

      public static <T> Stream<T> flatten(Collection<? extends Collection<? extends T>> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • flatten

      public static <T> Stream<T> flatten(T[][] a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • flatten

      public static <T> Stream<T> flatten(T[][] a, boolean vertically)
      Type Parameters:
      T -
      Parameters:
      a -
      vertically -
      Returns:
    • flatten

      public static <T> Stream<T> flatten(T[][] a, T valueForNone, boolean vertically)
      Type Parameters:
      T -
      Parameters:
      a -
      valueForNone -
      vertically -
      Returns:
    • flatten

      public static <T> Stream<T> flatten(T[][][] a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • repeat

      public static <T> Stream<T> repeat(T element, long n)
      Type Parameters:
      T -
      Parameters:
      element -
      n -
      Returns:
    • iterate

      public static <T> Stream<T> iterate(BooleanSupplier hasNext, Supplier<? extends T> next)
      Type Parameters:
      T -
      Parameters:
      hasNext -
      next -
      Returns:
    • iterate

      public static <T> Stream<T> iterate(T init, BooleanSupplier hasNext, UnaryOperator<T> f)
      Returns a sequential ordered Stream produced by iterative application of a function f to an initial element init, producing a Stream consisting of init, f(init), f(f(init)), etc.

      The first element (position 0) in the Stream will be the provided init. For n > 0, the element at position n, will be the result of applying the function f to the element at position n - 1.

      Type Parameters:
      T -
      Parameters:
      init -
      hasNext -
      f -
      Returns:
    • iterate

      public static <T> Stream<T> iterate(T init, Predicate<? super T> hasNext, UnaryOperator<T> f)
      Type Parameters:
      T -
      Parameters:
      init -
      hasNext - test if has next by hasNext.test(init) for first time and hasNext.test(f.apply(previous)) for remaining.
      f -
      Returns:
    • iterate

      public static <T> Stream<T> iterate(T init, UnaryOperator<T> f)
      Type Parameters:
      T -
      Parameters:
      init -
      f -
      Returns:
    • generate

      public static <T> Stream<T> generate(Supplier<T> supplier)
      Type Parameters:
      T -
      Parameters:
      supplier -
      Returns:
    • interval

      public static <T> Stream<T> interval(long intervalInMillis, Supplier<T> s)
      Type Parameters:
      T -
      Parameters:
      intervalInMillis -
      s -
      Returns:
    • interval

      public static <T> Stream<T> interval(long delayInMillis, long intervalInMillis, Supplier<T> s)
      Type Parameters:
      T -
      Parameters:
      delayInMillis -
      intervalInMillis -
      s -
      Returns:
      See Also:
    • interval

      public static <T> Stream<T> interval(long delay, long interval, TimeUnit unit, Supplier<T> s)
      Type Parameters:
      T -
      Parameters:
      delay -
      interval -
      unit -
      s -
      Returns:
    • interval

      public static <T> Stream<T> interval(long intervalInMillis, LongFunction<T> s)
      Type Parameters:
      T -
      Parameters:
      intervalInMillis -
      s -
      Returns:
    • interval

      public static <T> Stream<T> interval(long delayInMillis, long intervalInMillis, LongFunction<T> s)
      Type Parameters:
      T -
      Parameters:
      delayInMillis -
      intervalInMillis -
      s -
      Returns:
      See Also:
    • interval

      public static <T> Stream<T> interval(long delay, long interval, TimeUnit unit, LongFunction<T> s)
      Type Parameters:
      T -
      Parameters:
      delay -
      interval -
      unit -
      s -
      Returns:
    • lines

      public static Stream<String> lines(File file) throws UncheckedIOException
      Parameters:
      file -
      Returns:
      Throws:
      UncheckedIOException
    • lines

      public static Stream<String> lines(File file, Charset charset) throws UncheckedIOException
      Parameters:
      file -
      charset -
      Returns:
      Throws:
      UncheckedIOException
    • lines

      public static Stream<String> lines(Path path) throws UncheckedIOException
      Parameters:
      path -
      Returns:
      Throws:
      UncheckedIOException
    • lines

      public static Stream<String> lines(Path path, Charset charset) throws UncheckedIOException
      Parameters:
      path -
      charset -
      Returns:
      Throws:
      UncheckedIOException
    • lines

      public static Stream<String> lines(Reader reader) throws UncheckedIOException
      It's user's responsibility to close the input reader after the stream is finished.
      Parameters:
      reader -
      Returns:
      Throws:
      UncheckedIOException
    • listFiles

      public static Stream<File> listFiles(File parentPath) throws UncheckedIOException
      Parameters:
      parentPath -
      Returns:
      Throws:
      UncheckedIOException
    • listFiles

      public static Stream<File> listFiles(File parentPath, boolean recursively) throws UncheckedIOException
      Parameters:
      parentPath -
      recursively -
      Returns:
      Throws:
      UncheckedIOException
    • observe

      @Beta public static <T> Stream<T> observe(BlockingQueue<T> queue, Duration duration)
      Sample code:
       
       final BlockingQueue queue = new ArrayBlockingQueue<>(32);
       N.asyncExecute(() -> Stream.observe(queue, Duration.ofMillis(100)).filter(s -> s.startsWith("a")).forEach(Fn.println()));
       N.asList("a", "b", "ab", "bc", "1", "a").forEach(queue::add);
       N.sleep(10);
       N.println("==================");
       N.sleep(100);
       N.println("==================");
       N.sleep(10);
       
       
      Type Parameters:
      T -
      Parameters:
      queue -
      duration -
      Returns:
      See Also:
    • observe

      @Beta public static <T> Stream<T> observe(BlockingQueue<T> queue, BooleanSupplier hasMore, long maxWaitIntervalInMillis)
      Sample code:
       
       final BlockingQueue queue = new ArrayBlockingQueue<>(32);
       final MutableBoolean hasMore = MutableBoolean.of(true);
       N.asyncExecute(() -> Stream.observe(queue, () -> hasMore.value(), 10).filter(s -> s.startsWith("a")).forEach(Fn.println()));
       N.asList("a", "b", "ab", "bc", "1", "a").forEach(queue::add);
       N.println("==================");
       hasMore.setFalse();
       N.sleep(50);
       N.println("==================");
       
       
      Type Parameters:
      T -
      Parameters:
      queue -
      hasMore - it will will be set to true if Stream is completed and the upstream should not continue to put elements to queue when it's completed. This is an output parameter.
      maxWaitIntervalInMillis -
      Returns:
      See Also:
    • concat

      @SafeVarargs public static <T> Stream<T> concat(T[]... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • concat

      @SafeVarargs public static <T> Stream<T> concat(Iterable<? extends T>... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • concat

      @SafeVarargs public static <T> Stream<T> concat(Iterator<? extends T>... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • concat

      @SafeVarargs public static <T> Stream<T> concat(Stream<? extends T>... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • concat

      public static <T> Stream<T> concat(Collection<? extends Stream<? extends T>> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • concatIterables

      @Beta public static <T> Stream<T> concatIterables(Collection<? extends Iterable<? extends T>> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • concatIterators

      @Beta public static <T> Stream<T> concatIterators(Collection<? extends Iterator<? extends T>> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • parallelConcat

      @SafeVarargs public static <T> Stream<T> parallelConcat(Iterable<? extends T>... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Iterable<? extends T>[] a, int readThreadNum, int bufferSize)
      Type Parameters:
      T -
      Parameters:
      a -
      readThreadNum - - count of threads used to read elements from iterator to queue. Default value is min(8, a.length)
      bufferSize -
      Returns:
    • parallelConcat

      @SafeVarargs public static <T> Stream<T> parallelConcat(Iterator<? extends T>... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Iterator<? extends T>[] a, int readThreadNum, int bufferSize)
      Type Parameters:
      T -
      Parameters:
      a -
      readThreadNum - - count of threads used to read elements from iterator to queue. Default value is min(8, a.length)
      bufferSize -
      Returns:
    • parallelConcat

      @SafeVarargs public static <T> Stream<T> parallelConcat(Stream<? extends T>... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Stream<? extends T>[] a, int readThreadNum, int bufferSize)
      Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterators in parallel.
      Type Parameters:
      T -
      Parameters:
      a -
      readThreadNum - - count of threads used to read elements from iterator to queue. Default value is min(8, a.length)
      bufferSize -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Collection<? extends Stream<? extends T>> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Collection<? extends Stream<? extends T>> c, int readThreadNum)
      Type Parameters:
      T -
      Parameters:
      c -
      readThreadNum -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Collection<? extends Stream<? extends T>> c, int readThreadNum, int bufferSize)
      Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterators in parallel.
      Type Parameters:
      T -
      Parameters:
      c -
      readThreadNum - - count of threads used to read elements from iterator to queue. Default value is min(8, c.size())
      bufferSize - Default value is N.min(128, c.size() * 16)
      Returns:
    • parallelConcatIterables

      @Beta public static <T> Stream<T> parallelConcatIterables(Collection<? extends Iterable<? extends T>> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • parallelConcatIterables

      @Beta public static <T> Stream<T> parallelConcatIterables(Collection<? extends Iterable<? extends T>> c, int readThreadNum)
      Type Parameters:
      T -
      Parameters:
      c -
      readThreadNum -
      Returns:
    • parallelConcatIterables

      @Beta public static <T> Stream<T> parallelConcatIterables(Collection<? extends Iterable<? extends T>> c, int readThreadNum, int bufferSize)
      Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterators in parallel.
      Type Parameters:
      T -
      Parameters:
      c -
      readThreadNum - - count of threads used to read elements from iterator to queue. Default value is min(8, c.size())
      bufferSize - Default value is N.min(128, c.size() * 16)
      Returns:
    • parallelConcatIterators

      public static <T> Stream<T> parallelConcatIterators(Collection<? extends Iterator<? extends T>> c)
      Type Parameters:
      T -
      Parameters:
      c -
      Returns:
    • parallelConcatIterators

      public static <T> Stream<T> parallelConcatIterators(Collection<? extends Iterator<? extends T>> c, int readThreadNum)
      Type Parameters:
      T -
      Parameters:
      c -
      readThreadNum -
      Returns:
    • parallelConcatIterators

      public static <T> Stream<T> parallelConcatIterators(Collection<? extends Iterator<? extends T>> c, int readThreadNum, int bufferSize)
      Type Parameters:
      T -
      Parameters:
      c -
      readThreadNum - - count of threads used to read elements from iterator to queue. Default value is min(8, c.size())
      bufferSize - Default value is N.min(128, c.size() * 16)
      Returns:
    • zip

      public static <R> Stream<R> zip(char[] a, char[] b, CharBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(char[] a, char[] b, char[] c, CharTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharIterator c, CharTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharStream a, CharStream b, CharBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharStream a, CharStream b, CharStream c, CharTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends CharStream> c, CharNFunction<? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(char[] a, char[] b, char valueForNoneA, char valueForNoneB, CharBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(char[] a, char[] b, char[] c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharIterator a, CharIterator b, char valueForNoneA, char valueForNoneB, CharBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharIterator c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharStream a, CharStream b, char valueForNoneA, char valueForNoneB, CharBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharStream a, CharStream b, CharStream c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends CharStream> c, char[] valuesForNone, CharNFunction<? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(byte[] a, byte[] b, ByteBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(byte[] a, byte[] b, byte[] c, ByteTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteIterator c, ByteTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteStream c, ByteTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends ByteStream> c, ByteNFunction<? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(byte[] a, byte[] b, byte valueForNoneA, byte valueForNoneB, ByteBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(byte[] a, byte[] b, byte[] c, byte valueForNoneA, byte valueForNoneB, byte valueForNoneC, ByteTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, byte valueForNoneA, byte valueForNoneB, ByteBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteIterator c, byte valueForNoneA, byte valueForNoneB, byte valueForNoneC, ByteTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteStream a, ByteStream b, byte valueForNoneA, byte valueForNoneB, ByteBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteStream c, byte valueForNoneA, byte valueForNoneB, byte valueForNoneC, ByteTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends ByteStream> c, byte[] valuesForNone, ByteNFunction<? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(short[] a, short[] b, ShortBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(short[] a, short[] b, short[] c, ShortTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortIterator c, ShortTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortStream c, ShortTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends ShortStream> c, ShortNFunction<? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(short[] a, short[] b, short valueForNoneA, short valueForNoneB, ShortBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(short[] a, short[] b, short[] c, short valueForNoneA, short valueForNoneB, short valueForNoneC, ShortTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, short valueForNoneA, short valueForNoneB, ShortBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortIterator c, short valueForNoneA, short valueForNoneB, short valueForNoneC, ShortTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortStream a, ShortStream b, short valueForNoneA, short valueForNoneB, ShortBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortStream c, short valueForNoneA, short valueForNoneB, short valueForNoneC, ShortTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends ShortStream> c, short[] valuesForNone, ShortNFunction<? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(int[] a, int[] b, IntBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(int[] a, int[] b, int[] c, IntTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntIterator c, IntTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntStream a, IntStream b, IntBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntStream a, IntStream b, IntStream c, IntTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends IntStream> c, IntNFunction<? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(int[] a, int[] b, int valueForNoneA, int valueForNoneB, IntBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(int[] a, int[] b, int[] c, int valueForNoneA, int valueForNoneB, int valueForNoneC, IntTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntIterator a, IntIterator b, int valueForNoneA, int valueForNoneB, IntBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntIterator c, int valueForNoneA, int valueForNoneB, int valueForNoneC, IntTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntStream a, IntStream b, int valueForNoneA, int valueForNoneB, IntBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntStream a, IntStream b, IntStream c, int valueForNoneA, int valueForNoneB, int valueForNoneC, IntTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends IntStream> c, int[] valuesForNone, IntNFunction<? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(long[] a, long[] b, LongBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(long[] a, long[] b, long[] c, LongTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongIterator c, LongTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongStream a, LongStream b, LongBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongStream a, LongStream b, LongStream c, LongTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends LongStream> c, LongNFunction<? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(long[] a, long[] b, long valueForNoneA, long valueForNoneB, LongBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(long[] a, long[] b, long[] c, long valueForNoneA, long valueForNoneB, long valueForNoneC, LongTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongIterator a, LongIterator b, long valueForNoneA, long valueForNoneB, LongBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongIterator c, long valueForNoneA, long valueForNoneB, long valueForNoneC, LongTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongStream a, LongStream b, long valueForNoneA, long valueForNoneB, LongBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongStream a, LongStream b, LongStream c, long valueForNoneA, long valueForNoneB, long valueForNoneC, LongTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends LongStream> c, long[] valuesForNone, LongNFunction<? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(float[] a, float[] b, FloatBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(float[] a, float[] b, float[] c, FloatTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatIterator c, FloatTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatStream c, FloatTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends FloatStream> c, FloatNFunction<? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(float[] a, float[] b, float valueForNoneA, float valueForNoneB, FloatBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(float[] a, float[] b, float[] c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, float valueForNoneA, float valueForNoneB, FloatBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatIterator c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatStream a, FloatStream b, float valueForNoneA, float valueForNoneB, FloatBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatStream c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends FloatStream> c, float[] valuesForNone, FloatNFunction<? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(double[] a, double[] b, DoubleBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(double[] a, double[] b, double[] c, DoubleTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleIterator c, DoubleTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleStream c, DoubleTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends DoubleStream> c, DoubleNFunction<? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(double[] a, double[] b, double valueForNoneA, double valueForNoneB, DoubleBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(double[] a, double[] b, double[] c, double valueForNoneA, double valueForNoneB, double valueForNoneC, DoubleTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, double valueForNoneA, double valueForNoneB, DoubleBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleIterator c, double valueForNoneA, double valueForNoneB, double valueForNoneC, DoubleTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, double valueForNoneA, double valueForNoneB, DoubleBiFunction<? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleStream c, double valueForNoneA, double valueForNoneB, double valueForNoneC, DoubleTriFunction<? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends DoubleStream> c, double[] valuesForNone, DoubleNFunction<? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(A[] a, B[] b, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(A[] a, B[] b, C[] c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Iterable<? extends A> a, Iterable<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Stream<? extends A> a, Stream<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(Stream<? extends A> a, Stream<? extends B> b, Stream<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • zip

      public static <T, R> Stream<R> zip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,? extends R> zipFunction)
      Zip together the iterators until one of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      T -
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • zipIterables

      public static <T, R> Stream<R> zipIterables(Collection<? extends Iterable<? extends T>> collections, Function<? super List<? extends T>,? extends R> zipFunction)
      Type Parameters:
      T -
      R -
      Parameters:
      collections -
      zipFunction -
      Returns:
    • zipIterators

      public static <T, R> Stream<R> zipIterators(Collection<? extends Iterator<? extends T>> iterators, Function<? super List<? extends T>,? extends R> zipFunction)
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Iterable<? extends A> a, Iterable<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Stream<? extends A> a, Stream<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction)
      Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA - value to fill if "a" runs out of values first.
      valueForNoneB - value to fill if "b" runs out of values first.
      zipFunction -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(Stream<? extends A> a, Stream<? extends B> b, Stream<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA - value to fill if "a" runs out of values.
      valueForNoneB - value to fill if "b" runs out of values.
      valueForNoneC - value to fill if "c" runs out of values.
      zipFunction -
      Returns:
    • zip

      public static <T, R> Stream<R> zip(Collection<? extends Stream<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction)
      Zip together the iterators until all of them runs out of values. Each array of values is combined into a single value using the supplied zipFunction function.
      Type Parameters:
      T -
      R -
      Parameters:
      c -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • zipIterables

      public static <T, R> Stream<R> zipIterables(Collection<? extends Iterable<? extends T>> collections, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction)
      Type Parameters:
      T -
      R -
      Parameters:
      collections -
      valuesForNone -
      zipFunction -
      Returns:
    • zipIterators

      public static <T, R> Stream<R> zipIterators(Collection<? extends Iterator<? extends T>> iterators, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction)
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      valuesForNone - value to fill for any iterator runs out of values.
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
      See Also:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      bufferSize -
      Returns:
      See Also:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize, int maxThreadNumForZipFunction)
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      bufferSize -
      maxThreadNumForZipFunction -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize, int maxThreadNumForZipFunction)
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      bufferSize -
      maxThreadNumForZipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, BiFunction<? super A,? super B,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, Stream<C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, Stream<C> c, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <T, R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      c -
      zipFunction -
      Returns:
    • parallelZip

      public static <T, R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      c -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      Returns:
      See Also:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      bufferSize -
      Returns:
      See Also:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize, int maxThreadNumForZipFunction)
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      bufferSize -
      maxThreadNumForZipFunction -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      Returns:
      See Also:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      bufferSize -
      Returns:
      See Also:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize, int maxThreadNumForZipFunction)
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      bufferSize -
      maxThreadNumForZipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      R -
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, Stream<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, C, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, Stream<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      A -
      B -
      C -
      R -
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <T, R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      c -
      valuesForNone -
      zipFunction -
      Returns:
    • parallelZip

      public static <T, R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      c -
      valuesForNone -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZipIterables

      @Beta public static <T, R> Stream<R> parallelZipIterables(Collection<? extends Iterable<? extends T>> collections, Function<? super List<? extends T>,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      collections -
      zipFunction -
      Returns:
    • parallelZipIterables

      @Beta public static <T, R> Stream<R> parallelZipIterables(Collection<? extends Iterable<? extends T>> collections, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      collections -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZipIterables

      @Beta public static <T, R> Stream<R> parallelZipIterables(Collection<? extends Iterable<? extends T>> collections, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      collections -
      valuesForNone -
      zipFunction -
      Returns:
    • parallelZipIterables

      @Beta public static <T, R> Stream<R> parallelZipIterables(Collection<? extends Iterable<? extends T>> collections, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      collections -
      valuesForNone -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, Function<? super List<? extends T>,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      zipFunction -
      Returns:
      See Also:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      zipFunction -
      bufferSize -
      Returns:
      See Also:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize, int maxThreadNumForZipFunction)
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      zipFunction -
      bufferSize -
      maxThreadNumForZipFunction -
      Returns:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      valuesForNone -
      zipFunction -
      Returns:
      See Also:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize)
      A new thread will be started for each Iterator/Collection/Stream to read the elements to queue for the zipFunction. But the zipFunction will be executed in a single thread, not multiple threads. To parallelize the zipFunction, call Stream.parallelZip(..., bufferSize, maxThreadNumForZipFunction) or Stream.parallelZip(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      valuesForNone -
      zipFunction -
      bufferSize -
      Returns:
      See Also:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, List<? extends T> valuesForNone, Function<? super List<? extends T>,? extends R> zipFunction, int bufferSize, int maxThreadNumForZipFunction)
      Type Parameters:
      T -
      R -
      Parameters:
      iterators -
      valuesForNone -
      zipFunction -
      bufferSize -
      maxThreadNumForZipFunction -
      Returns:
    • merge

      public static <T> Stream<T> merge(T[] a, T[] b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • merge

      public static <T> Stream<T> merge(T[] a, T[] b, T[] c, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      c -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • merge

      public static <T> Stream<T> merge(Iterable<? extends T> a, Iterable<? extends T> b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • merge

      public static <T> Stream<T> merge(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      c -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • merge

      public static <T> Stream<T> merge(Iterator<? extends T> a, Iterator<? extends T> b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • merge

      public static <T> Stream<T> merge(Iterator<? extends T> a, Iterator<? extends T> b, Iterator<? extends T> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      c -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • merge

      public static <T> Stream<T> merge(Stream<? extends T> a, Stream<? extends T> b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • merge

      public static <T> Stream<T> merge(Stream<? extends T> a, Stream<? extends T> b, Stream<? extends T> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      c -
      nextSelector -
      Returns:
    • merge

      public static <T> Stream<T> merge(Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      c -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • mergeIterables

      public static <T> Stream<T> mergeIterables(Collection<? extends Iterable<? extends T>> collections, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      collections -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • mergeIterators

      public static <T> Stream<T> mergeIterators(Collection<? extends Iterator<? extends T>> iterators, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Type Parameters:
      T -
      Parameters:
      iterators -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • parallelMerge

      public static <T> Stream<T> parallelMerge(Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
      All the elements from each input Collection/Iterator/Stream will be merged into two queues by multiple threads. Then these two new queues will be merged into one Iterator/Stream by one thread. So it's not totally lazy evaluation and may cause out of memory error if there are too many elements merged into the new queues. Consider using merge, which is totally lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      c -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • parallelMerge

      public static <T> Stream<T> parallelMerge(Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector, int maxThreadNum)
      All the elements from each input Collection/Iterator/Stream will be merged into two queues by multiple threads. Then these two new queues will be merged into one Iterator/Stream by one thread. So it's not totally lazy evaluation and may cause out of memory error if there are too many elements merged into the new queues. Consider using merge, which is totally lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      c -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      maxThreadNum -
      Returns:
    • parallelMergeIterables

      public static <T> Stream<T> parallelMergeIterables(Collection<? extends Iterable<? extends T>> collections, BiFunction<? super T,? super T,MergeResult> nextSelector)
      All the elements from each input Collection/Iterator/Stream will be merged into two queues by multiple threads. Then these two new queues will be merged into one Iterator/Stream by one thread. So it's not totally lazy evaluation and may cause out of memory error if there are too many elements merged into the new queues. Consider using merge, which is totally lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      collections -
      nextSelector -
      Returns:
    • parallelMergeIterables

      public static <T> Stream<T> parallelMergeIterables(Collection<? extends Iterable<? extends T>> collections, BiFunction<? super T,? super T,MergeResult> nextSelector, int maxThreadNum)
      All the elements from each input Collection/Iterator/Stream will be merged into two queues by multiple threads. Then these two new queues will be merged into one Iterator/Stream by one thread. So it's not totally lazy evaluation and may cause out of memory error if there are too many elements merged into the new queues. Consider using merge, which is totally lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      collections -
      nextSelector -
      maxThreadNum -
      Returns:
    • parallelMergeIterators

      public static <T> Stream<T> parallelMergeIterators(Collection<? extends Iterator<? extends T>> iterators, BiFunction<? super T,? super T,MergeResult> nextSelector)
      All the elements from each input Collection/Iterator/Stream will be merged into two queues by multiple threads. Then these two new queues will be merged into one Iterator/Stream by one thread. So it's not totally lazy evaluation and may cause out of memory error if there are too many elements merged into the new queues. Consider using merge, which is totally lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      iterators -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      Returns:
    • parallelMergeIterators

      public static <T> Stream<T> parallelMergeIterators(Collection<? extends Iterator<? extends T>> iterators, BiFunction<? super T,? super T,MergeResult> nextSelector, int maxThreadNum)
      All the elements from each input Collection/Iterator/Stream will be merged into two queues by multiple threads. Then these two new queues will be merged into one Iterator/Stream by one thread. So it's not totally lazy evaluation and may cause out of memory error if there are too many elements merged into the new queues. Consider using merge, which is totally lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      iterators -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      maxThreadNum -
      Returns:
    • elementAt

      public u.Optional<T> elementAt(long position)
      Specified by:
      elementAt in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      position -
      Returns:
    • rateLimited

      public Stream<T> rateLimited(double permitsPerSecond)
      Specified by:
      rateLimited in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      permitsPerSecond -
      Returns:
      See Also:
    • peek

      public Stream<T> peek(Consumer<? super T> action)
      Specified by:
      peek in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      action -
      Returns:
    • sliding

      public Stream<Stream<T>> sliding(int windowSize)
      Specified by:
      sliding in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      windowSize -
      Returns:
      See Also:
    • slidingToList

      public Stream<List<T>> slidingToList(int windowSize)
      Specified by:
      slidingToList in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      windowSize -
      Returns:
      See Also:
    • shuffled

      public Stream<T> shuffled()
      Description copied from interface: BaseStream

      This method only runs sequentially, even in parallel stream and all elements will be loaded to memory.
      Specified by:
      shuffled in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Returns:
    • throwIfEmpty

      @SequentialOnly @IntermediateOp public Stream<T> throwIfEmpty(Supplier<? extends RuntimeException> exceptionSupplier)
      Specified by:
      throwIfEmpty in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      exceptionSupplier -
      Returns:
    • toImmutableList

      public ImmutableList<T> toImmutableList()
      Specified by:
      toImmutableList in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Returns:
    • toImmutableSet

      public ImmutableSet<T> toImmutableSet()
      Specified by:
      toImmutableSet in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Returns:
    • join

      public String join(CharSequence delimiter)
      Specified by:
      join in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      delimiter -
      Returns:
    • println

      public void println()
      Specified by:
      println in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
    • transform

      public <SS extends BaseStream> SS transform(Function<? super Stream<T>,? extends SS> transfer)
      Specified by:
      transform in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Type Parameters:
      SS -
      Parameters:
      transfer -
      Returns:
    • __

      @Deprecated public <SS extends BaseStream> SS __(Function<? super Stream<T>,? extends SS> transfer)
      Deprecated.
      Specified by:
      __ in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Type Parameters:
      SS -
      Parameters:
      transfer -
      Returns:
    • isParallel

      public boolean isParallel()
      Specified by:
      isParallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Returns:
    • sequential

      public Stream<T> sequential()
      Specified by:
      sequential in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Returns:
    • parallel

      public Stream<T> parallel()
      Description copied from interface: BaseStream
      Consider using sps(Function) if only next operation need to be parallelized. For example:
       stream.parallel().map(f).filter(p)...;
      
       // Replace above line of code with "sps" if only "f" need to be parallelized. And "p" is fast enough to be executed in sequential Stream.
       stream.sps(s -> s.map(f)).filter(p)...;
       // Or switch the stream back sequential stream if don't use "sps".
       stream.parallel().map(f).sequential().filter(p)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(Function) is recommended in most of scenarios.
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(int maxThreadNum)
      Description copied from interface: BaseStream
      Consider using sps(int, Function) if only next operation need to be parallelized. For example:
       stream.parallel(maxThreadNum).map(f).filter(p)...;
      
       // Replace above line of code with "sps" if only "f" need to be parallelized. And "p" is fast enough to be executed in sequential Stream.
       stream.sps(maxThreadNum, s -> s.map(f)).filter(p)...;
       // Or switch the stream back sequential stream if don't use "sps".
       stream.parallel(maxThreadNum).map(f).sequential().filter(p)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(int, Function) is recommended in most of scenarios.
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      maxThreadNum -
      Returns:
      See Also:
      • #maxThreadNumPerOperation()
    • parallel

      public Stream<T> parallel(BaseStream.Splitor splitor)
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      splitor -
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(int maxThreadNum, BaseStream.Splitor splitor)
      Description copied from interface: BaseStream
      Returns an equivalent stream that is parallel. May return itself if the stream was already parallel with the same maxThreadNum and splitor as the specified ones.

      When to use parallel Streams?
       
       Profiler.run(1, 1, 3, "sequential", () -> Stream.of(list).operation(F)...).printResult();
       Profiler.run(1, 1, 3, "parallel", () -> Stream.of(list).parallel().operation(F)...).printResult();
       
       
      Here is a sample performance test with computer: CPU Intel i7-3520M 4-cores 2.9 GHz, JDK 1.8.0_101, Windows 7:
       
      
           public void test_perf() {
              final String[] strs = new String[10_000];
              N.fill(strs, N.uuid());
          
              final int m = 10;
              final Function<String, Long> mapper = str -> {
                  long result = 0;
                  for (int i = 0; i < m; i++) {
                      result += N.sum(str.toCharArray()) + 1;
                  }
                  return result;
              };
          
              final MutableLong sum = MutableLong.of(0);
          
              for (int i = 0, len = strs.length; i < len; i++) {
                  sum.add(mapper.apply(strs[i]));
              }
          
              final int threadNum = 1, loopNum = 100, roundNum = 3;
          
              Profiler.run(threadNum, loopNum, roundNum, "For Loop", () -> {
                  long result = 0;
                  for (int i = 0, len = strs.length; i < len; i++) {
                      result += mapper.apply(strs[i]);
                  }
                  assertEquals(sum.longValue(), result);
              }).printResult();
          
              Profiler.run(threadNum, loopNum, roundNum, "JDK Sequential",
                      () -> assertEquals(sum.longValue(), java.util.stream.Stream.of(strs).map(mapper).mapToLong(e -> e).sum())).printResult();
          
              Profiler.run(threadNum, loopNum, roundNum, "JDK Parallel",
                      () -> assertEquals(sum.longValue(), java.util.stream.Stream.of(strs).parallel().map(mapper).mapToLong(e -> e).sum())).printResult();
          
              Profiler.run(threadNum, loopNum, roundNum, "Abcus Sequential", () -> assertEquals(sum.longValue(), Stream.of(strs).map(mapper).mapToLong(e -> e).sum()))
                      .printResult();
          
              Profiler.run(threadNum, loopNum, roundNum, "Abcus Parallel",
                      () -> assertEquals(sum.longValue(), Stream.of(strs).parallel().map(mapper).mapToLong(e -> e).sum())).printResult();
          
              Profiler.run(threadNum, loopNum, roundNum, "Abcus Parallel by chunck", () -> assertEquals(sum.longValue(),
                      Stream.of(strs).splitToList(100).parallel().map(it -> N.sumLong(it, e -> mapper.apply(e))).mapToLong(e -> e).sum())).printResult();
           }
          
       
       
      And test result: Unit is milliseconds. N(the number of elements) is 10_000, Q(cost per element of F, the per-element function (usually a lambda), here is mapper) is calculated by: value of 'For loop' / N(10_000).
      m = 1 m = 10m = 50m = 100m = 500m = 1000
      Q 0.000020.00020.0010.0020.010.02
      For Loop0.232.31122110219
      JDK Sequential0.282.31122114212
      JDK Parallel0.221.361266122
      Abcus Sequential0.321122112212
      Abcus Parallel1111111677128
      Comparison:
      • Again, do NOT and should NOT use parallel Streams if you don't have any performance problem with sequential Streams, because using parallel Streams has extra cost.
      • Again, consider using parallel Streams only when N(the number of elements) * Q(cost per element of F, the per-element function (usually a lambda)) is big enough.
      • The implementation of parallel Streams in Abacus is more than 10 times, slower than parallel Streams in JDK when Q is tiny(here is less than 0.0002 milliseconds by the test):
        • The implementation of parallel Streams in JDK 8 still can beat the sequential/for loop when Q is tiny(Here is 0.00002 milliseconds by the test). That's amazing, considering the extra cost brought by parallel computation. It's well done.
        • The implementation of parallel Streams in Abacus is pretty simple and straight forward. The extra cost(starting threads/synchronization/queue...) brought by parallel Streams in Abacus is too bigger to tiny Q(Here is less than 0.001 milliseconds by the test). But it starts to be faster than sequential Streams when Q is big enough(Here is 0.001 milliseconds by the test) and starts to catch the parallel Streams in JDK when Q is bigger(Here is 0.01 milliseconds by the test).
        • Consider using the parallel Streams in Abacus when Q is big enough, specially when IO involved in F. Because one IO operation(e.g. DB/web service request..., Reading/Writing file...) usually takes 1 to 1000 milliseconds, or even longer. By the parallel Streams APIs in Abacus, it's very simple to specify max thread numbers. Sometimes, it's much faster to execute IO/Network requests with a bit more threads. It's fair to say that the parallel Streams in Abacus is high efficient, may same as or faster than the parallel Streams in JDK when Q is big enough, except F is heavy cpu-used operation. Most of the times, the Q is big enough to consider using parallel Stream is because IO/Network is involved in F.
      • JDK 7 is supported by the Streams in Abacus. It's perfect to work with retrolambda on Android
      • All primitive types are supported by Stream APIs in Abacus except boolean


      A bit more about Lambdas/Stream APIs, you may heard that Lambdas/Stream APIs is 5 time slower than imperative programming. It's true when Q and F is VERY, VERY tiny, like f = (int a, int b) -> a + b;. But if we look into the samples in the article and think about it: it just takes less than 1 milliseconds to get the max value in 100k numbers. There is potential performance issue only if the "get the max value in 100K numbers" call many, many times in your API or single request. Otherwise, the difference between 0.1 milliseconds to 0.5 milliseconds can be totally ignored. Usually we meet performance issue only if Q and F is big enough. However, the performance of Lambdas/Streams APIs is closed to for loop when Q and F is big enough. No matter in which scenario, We don't need and should not concern the performance of Lambdas/Stream APIs.

      Although it's is parallel Streams, it doesn't means all the methods are executed in parallel. Because the sequential way is as fast, or even faster than the parallel way for some methods, or is pretty difficult, if not possible, to implement the method by parallel approach. Here are the methods which are executed sequentially even in parallel Streams.

      splitXXX/splitAt/splitBy/slidingXXX/collapse, distinct, reverse, rotate, shuffle, indexed, cached, top, kthLargest, count, toArray, toList, toList, toSet, toMultiset, toLongMultiset, intersection(Collection c), difference(Collection c), symmetricDifference(Collection c), forEach(identity, accumulator, predicate), findFirstOrLast, findFirstAndLast
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      maxThreadNum -
      splitor -
      Returns:
      See Also:
      • #maxThreadNumPerOperation()
    • parallel

      public Stream<T> parallel(int maxThreadNum, Executor executor)
      Description copied from interface: BaseStream
      // Replace above line of code with "sps" if only "f" need to be parallelized. And "p" is fast enough to be executed in sequential Stream. stream.sps(SP.create(maxThreadNum, executor), s -> s.map(f)).filter(p)...; // Or switch the stream back sequential stream if don't use "sps". stream.parallel(maxThreadNum, executor).map(f).sequential().filter(p)...;
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      maxThreadNum -
      executor -
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(Executor executor)
      Description copied from interface: BaseStream
       stream.parallel(executor).map(f).filter(p)...;
      
       // Replace above line of code with "sps" if only "f" need to be parallelized. And "p" is fast enough to be executed in sequential Stream.
       stream.sps(SP.create(executor), s -> s.map(f)).filter(p)...;
       // Or switch the stream back sequential stream if don't use "sps".
       stream.parallel(executor).map(f).sequential().filter(p)...;
      
       
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      executor -
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(int maxThreadNum, BaseStream.Splitor splitor, Executor executor)
      Description copied from interface: BaseStream
       stream.parallel(maxThreadNum, splitor, executor).map(f).filter(p)...;
      
       // Replace above line of code with "sps" if only "f" need to be parallelized. And "p" is fast enough to be executed in sequential Stream.
       stream.sps(SP.create(maxThreadNum, splitor, executor), s -> s.map(f)).filter(p)...;
       // Or switch the stream back sequential stream if don't use "sps".
       stream.parallel(maxThreadNum, splitor, executor).map(f).sequential().filter(p)...;
      
       
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      maxThreadNum -
      splitor -
      executor -
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(BaseStream.ParallelSettings ps)
      Description copied from interface: BaseStream
       stream.parallel(parallelSettings).map(f).filter(p)...;
      
       // Replace above line of code with "sps" if only "f" need to be parallelized. And "p" is fast enough to be executed in sequential Stream.
       stream.sps(SP.create(parallelSettings), s -> s.map(f)).filter(p)...;
       // Or switch the stream back sequential stream if don't use "sps".
       stream.parallel(parallelSettings).map(f).sequential().filter(p)...;
      
       
      Specified by:
      parallel in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Parameters:
      ps -
      Returns:
      See Also:
    • sps

      public <SS extends BaseStream> SS sps(Function<? super Stream<T>,? extends SS> ops)
      Description copied from interface: BaseStream
      Temporarily switch the stream to parallel stream for operation ops and then switch back to sequence stream.
      stream().parallel().ops(map/filter/...).sequence()
      Specified by:
      sps in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Type Parameters:
      SS -
      Parameters:
      ops -
      Returns:
    • sps

      public <SS extends BaseStream> SS sps(int maxThreadNum, Function<? super Stream<T>,? extends SS> ops)
      Description copied from interface: BaseStream
      Temporarily switch the stream to parallel stream for operation ops and then switch back to sequence stream.
      stream().parallel(maxThreadNum).ops(map/filter/...).sequence()
      Specified by:
      sps in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Type Parameters:
      SS -
      Parameters:
      maxThreadNum -
      ops -
      Returns:
    • psp

      public <SS extends BaseStream> SS psp(Function<? super Stream<T>,? extends SS> ops)
      Description copied from interface: BaseStream
      Temporarily switch the stream to sequence stream for operation ops and then switch back to parallel stream with same maxThreadNum/splitor/asyncExecutor.
      stream().sequence().ops(map/filter/...).parallel(sameMaxThreadNum, sameSplitor, sameAsyncExecutor)
      Specified by:
      psp in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Type Parameters:
      SS -
      Parameters:
      ops -
      Returns:
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Returns:
    • close

      public void close()
      Description copied from interface: BaseStream
      It will be called by terminal operations in final.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface BaseStream<T,A,P,C,PL,OT,IT,ITER extends Iterator<T>,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
      Specified by:
      close in interface Closeable