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<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)
    • pairWith

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

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper)
    • slidingMap

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

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper, int increment, boolean ignoreNotPaired)
    • slidingMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper)
    • slidingMap

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

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper, int increment, boolean ignoreNotPaired)
    • 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)
    • mapFirstOrElse

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

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

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

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

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

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

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

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

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

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

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

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

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
    • flattMap

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flattMap(Function<? super T,? extends Collection<? extends R>> mapper)
    • flatMapp

      @ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatMapp(Function<? super T,R[]> mapper)
    • flatMapToChar

      @ParallelSupported @IntermediateOp public abstract CharStream flatMapToChar(Function<? super T,? extends CharStream> mapper)
    • flattMapToChar

      @ParallelSupported @IntermediateOp public abstract CharStream flattMapToChar(Function<? super T,char[]> mapper)
    • flatMapToByte

      @ParallelSupported @IntermediateOp public abstract ByteStream flatMapToByte(Function<? super T,? extends ByteStream> mapper)
    • flattMapToByte

      @ParallelSupported @IntermediateOp public abstract ByteStream flattMapToByte(Function<? super T,byte[]> mapper)
    • flatMapToShort

      @ParallelSupported @IntermediateOp public abstract ShortStream flatMapToShort(Function<? super T,? extends ShortStream> mapper)
    • flattMapToShort

      @ParallelSupported @IntermediateOp public abstract ShortStream flattMapToShort(Function<? super T,short[]> mapper)
    • flatMapToInt

      @ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(Function<? super T,? extends IntStream> mapper)
    • flattMapToInt

      @ParallelSupported @IntermediateOp public abstract IntStream flattMapToInt(Function<? super T,int[]> mapper)
    • flatMapToLong

      @ParallelSupported @IntermediateOp public abstract LongStream flatMapToLong(Function<? super T,? extends LongStream> mapper)
    • flattMapToLong

      @ParallelSupported @IntermediateOp public abstract LongStream flattMapToLong(Function<? super T,long[]> mapper)
    • flatMapToFloat

      @ParallelSupported @IntermediateOp public abstract FloatStream flatMapToFloat(Function<? super T,? extends FloatStream> mapper)
    • flattMapToFloat

      @ParallelSupported @IntermediateOp public abstract FloatStream flattMapToFloat(Function<? super T,float[]> mapper)
    • flatMapToDouble

      @ParallelSupported @IntermediateOp public abstract DoubleStream flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
    • flattMapToDouble

      @ParallelSupported @IntermediateOp public abstract DoubleStream flattMapToDouble(Function<? super T,double[]> mapper)
    • flatMapToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> flatMapToEntry(Function<? super T,? extends Stream<? extends Map.Entry<? extends K,? extends V>>> mapper)
    • flattMapToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> flattMapToEntry(Function<? super T,? extends Map<? extends K,? extends V>> mapper)
    • flatMappToEntry

      @ParallelSupported @IntermediateOp public abstract <K, V> EntryStream<K,V> flatMappToEntry(Function<? super T,? extends EntryStream<? extends K,? extends V>> mapper)
    • flattMapIfNotNull

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

      @Beta @ParallelSupported @IntermediateOp public <U, R> Stream<R> flattMapIfNotNull(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)
    • mapMultiToInt

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

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

      @Beta @ParallelSupported @IntermediateOp public abstract DoubleStream mapMultiToDouble(BiConsumer<? super T,? super DoubleConsumer> mapper)
    • 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)
    • 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)
    • 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)
      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)
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • groupBy

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

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

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

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, A, D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
      Type Parameters:
      K -
      V -
      A - // TODO do we need A
      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)
    • 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)
    • groupByToEntry

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> EntryStream<K,List<T>> groupByToEntry(Function<? super T,? extends K> keyMapper)
    • 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)
    • 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)
      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)
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • groupByToEntry

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

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

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

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K, V, A, D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
    • 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)
    • 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)
    • 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 <A, D> Stream<Map.Entry<Boolean,D>> partitionBy(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
      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 <A, D> EntryStream<Boolean,D> partitionByToEntry(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
      Parameters:
      predicate -
      downstream -
      Returns:
      See Also:
    • countBy

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

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

      @SequentialOnly @IntermediateOp public abstract Stream<Stream<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, A> Stream<R> collapse(BiPredicate<? super T,? super T> collapsible, Collector<? super T,A,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.
      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<Stream<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, A> Stream<R> collapse(TriPredicate<? super T,? super T,? super T> collapsible, Collector<? super T,A,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.
      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.
      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)
      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.
      Parameters:
      chunkSize - the desired size of each sub sequence (the last may be smaller).
      collectionSupplier -
      Returns:
    • split

      @SequentialOnly @IntermediateOp public abstract <A, R> Stream<R> split(int chunkSize, Collector<? super T,A,R> collector)
      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)
    • split

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

      @SequentialOnly @IntermediateOp public abstract <A, R> Stream<R> split(Predicate<? super T> predicate, Collector<? super T,A,R> collector)
    • splitAt

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

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

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

      @SequentialOnly @IntermediateOp public abstract <A, R> Stream<R> sliding(int windowSize, Collector<? super T,A,R> collector)
    • sliding

      @SequentialOnly @IntermediateOp public abstract <A, R> Stream<R> sliding(int windowSize, int increment, Collector<? super T,A,R> collector)
    • 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.
      Parameters:
      keyMapper -
      mergeFunction -
      Returns:
      See Also:
    • distinctBy

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

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

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

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

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

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

      @ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> reverseSorted(Comparator<? super T> comparator)
    • 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:
      fromIndexInclusive -
      toIndexExclusive -
      Returns:
    • skipNull

      @SequentialOnly @IntermediateOp public abstract Stream<T> skipNull()
    • 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)
      Returns:
      See Also:
    • peekFirst

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

      @SequentialOnly @IntermediateOp public abstract Stream<T> peekLast(Consumer<? super T> action)
    • 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:
    • onErrorContinue

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorContinue(Consumer<? super Throwable> errorConsumer)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      errorConsumer -
      Returns:
    • onErrorContinue

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorContinue(Class<? extends Throwable> type, Consumer<? super Throwable> errorConsumer)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      type -
      errorConsumer -
      Returns:
    • onErrorContinue

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorContinue(Predicate<? super Throwable> errorPredicate, Consumer<? super Throwable> errorConsumer)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      errorPredicate -
      errorConsumer -
      Returns:
    • onErrorContinue

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorContinue(Predicate<? super Throwable> errorPredicate, Consumer<? super Throwable> errorConsumer, int maxErrorCountToStop)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      errorPredicate -
      errorConsumer -
      maxErrorCountToStop -
      Returns:
    • onErrorReturn

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorReturn(T fallbackValue)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      fallbackValue -
      Returns:
    • onErrorReturn

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorReturn(Class<? extends Throwable> type, T fallbackValue)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      type -
      fallbackValue -
      Returns:
    • onErrorReturn

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorReturn(Predicate<? super Throwable> predicate, T fallbackValue)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      predicate -
      fallbackValue -
      Returns:
    • onErrorReturn

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorReturn(Predicate<? super Throwable> predicate, Supplier<? extends T> supplierForFallbackValue)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      predicate -
      supplierForFallbackValue -
      Returns:
    • onErrorReturn

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorReturn(Predicate<? super Throwable> predicate, Function<? super Throwable,? extends T> mapperForFallbackValue, int maxErrorCountToStop)
      This method should be only applied sequential Stream and whose up-streams are sequential Streams as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.
      Parameters:
      predicate -
      mapperForFallbackValue -
      maxErrorCountToStop -
      Returns:
    • onErrorStop

      @Beta @SequentialOnly @IntermediateOp public abstract Stream<T> onErrorStop()
      Returns:
    • forEach

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

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

      @Beta @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachUntil(Throwables.BiConsumer<? super T,MutableBoolean,E> action) throws E
      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
      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
      Throws:
      E extends Exception
      E2 extends Exception
    • 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
      Throws:
      E extends Exception
      E2 extends Exception
    • 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
      Throws:
      E extends Exception
      E2 extends Exception
      E3 extends Exception
    • forEachPair

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

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachPair(Throwables.BiConsumer<? super T,? super T,E> action, int increment) throws E
      Slide with windowSize = 2 and the specified increment, then consume by the specified mapper.
      Parameters:
      mapper -
      increment -
      Throws:
      E extends Exception
    • forEachTriple

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

      @ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachTriple(Throwables.TriConsumer<? super T,? super T,? super T,E> action, int increment) throws E
      Slide with windowSize = 3 and the specified increment, then consume by the specified mapper.
      Parameters:
      mapper -
      increment -
      Throws:
      E extends Exception
    • anyMatch

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

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

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

      @ParallelSupported @TerminalOp public abstract <E extends Exception> boolean nMatch(long atLeast, long atMost, Throwables.Predicate<? super T,E> predicate) throws E
      Throws:
      E extends Exception
    • 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
      Throws:
      E extends Exception
      E2 extends Exception
    • 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.
      Parameters:
      init -
      predicateForFirst -
      predicateForLast -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
    • 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.
      Parameters:
      preFunc -
      predicateForFirst -
      predicateForLast -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
    • containsAll

      @SequentialOnly @TerminalOp public abstract boolean containsAll(T... a)
    • containsAll

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

      @SequentialOnly @TerminalOp public abstract boolean containsAny(T... a)
    • containsAny

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

      @SequentialOnly @TerminalOp public abstract <A> A[] toArray(IntFunction<A[]> generator)
    • 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
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      mapFactory -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      See Also:
    • toMap

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

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

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

      @Deprecated @ParallelSupported @TerminalOp public final <K, V, A, D, M extends Map<K, D>, E extends Exception, E2 extends Exception> M toMap(Throwables.Function<? super T,? extends K,E> keyMapper, Throwables.Function<? super T,? extends V,E2> valueMapper, Collector<? super V,A,D> downstream, Supplier<? extends M> mapFactory) throws E, E2
      Deprecated.
      replaced by groupTo
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      mapFactory -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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
      Parameters:
      keyMapper -
      Returns:
      Throws:
      E extends Exception
      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
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
      Throws:
      E extends Exception
      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
      Throws:
      E extends Exception
      E2 extends Exception
    • 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
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      See Also:
    • groupTo

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

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

      @ParallelSupported @TerminalOp public abstract <K, V, A, 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,A,D> downstream) throws E, E2
      Parameters:
      keyMapper -
      valueMapper -
      downstream -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      See Also:
    • groupTo

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

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

      @ParallelSupported @TerminalOp public abstract <K, V, A, 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,A,D> downstream) throws E, E2
      Type Parameters:
      K -
      V -
      A -
      D -
      E -
      E2 -
      Parameters:
      flatKeyMapper -
      valueMapper -
      downstream -
      Returns:
      Throws:
      E
      E2
    • flatGroupTo

      @ParallelSupported @TerminalOp public abstract <K, V, A, 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,A,D> downstream, Supplier<? extends M> mapFactory) throws E, E2
      Type Parameters:
      K -
      V -
      A -
      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
      Parameters:
      predicate -
      Returns:
      Throws:
      E extends Exception
      See Also:
    • partitionTo

      @ParallelSupported @TerminalOp public abstract <A, D, E extends Exception> Map<Boolean,D> partitionTo(Throwables.Predicate<? super T,E> predicate, Collector<? super T,A,D> downstream) throws E
      Parameters:
      predicate -
      downstream -
      Returns:
      Throws:
      E extends Exception
      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
      Parameters:
      keyMapper -
      Returns:
      Throws:
      E extends Exception
      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
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
      Throws:
      E extends Exception
      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
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
      Throws:
      E extends Exception
      E2 extends Exception
      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 entity or map.
      Returns:
      Throws:
      E
    • 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 entity or map.
      Parameters:
      columnNames -
      Returns:
      Throws:
      E
    • join

      @SequentialOnly @TerminalOp public abstract String join(Joiner joiner)
    • 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
      Parameters:
      accumulator -
      Returns:
      Throws:
      E extends Exception
      See Also:
    • reduce

      @ParallelSupported @TerminalOp public <E extends Exception> T reduce(T identity, Throwables.BinaryOperator<T,E> accumulator) throws E
      Parameters:
      identity -
      accumulator -
      Returns:
      Throws:
      E extends Exception
      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 -
      Parameters:
      identity -
      accumulator -
      combiner -
      Returns:
      Throws:
      E extends Exception
      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
      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 extends Exception
      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
      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 extends Exception
      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 -
      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 extends Exception
      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)
      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 -
      Returns:
      See Also:
    • collect

      @ParallelSupported @TerminalOp public abstract <R, A> R collect(Collector<? super T,A,R> collector)
    • collectAndThen

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

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

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

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

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

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

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

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

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

      @ParallelSupported @TerminalOp public abstract List<T> maxAll(Comparator<? super T> comparator)
    • 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)
    • sumLong

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

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

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

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

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

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

      @SequentialOnly @TerminalOp public abstract boolean hasDuplicates()
    • 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)
    • cartesianProduct

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

      @SequentialOnly @IntermediateOp public abstract Stream<List<T>> cartesianProduct(Collection<? extends Collection<? extends T>> cs)
    • 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.
      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.
      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)
    • prepend

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

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

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

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

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

    • 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:
    • merge

      @Deprecated @SequentialOnly @IntermediateOp public Stream<T> merge(Stream<? extends T> b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      Deprecated.
      replaced by mergeWith(Stream, BiFunction)
      Parameters:
      b -
      nextSelector - first parameter is selected if Nth.FIRST is returned, otherwise the second parameter is selected.
      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,R> zipFunction)
    • zipWith

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

      @ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Collection<T2> b, Collection<T3> c, TriFunction<? super T,? super T2,? super T3,R> zipFunction)
    • 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,R> zipFunction)
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(Stream<T2> b, BiFunction<? super T,? super T2,R> zipFunction)
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, R> Stream<R> zipWith(Stream<T2> b, T valueForNoneA, T2 valueForNoneB, BiFunction<? super T,? super T2,R> zipFunction)
    • zipWith

      @ParallelSupported @IntermediateOp public abstract <T2, T3, R> Stream<R> zipWith(Stream<T2> b, Stream<T3> c, TriFunction<? super T,? super T2,? super T3,R> zipFunction)
    • 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,R> zipFunction)
    • persist

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

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

      @SequentialOnly @TerminalOp public abstract long persist(Throwables.Function<? super T,String,IOException> toLine, File file) throws IOException
      toCSV:
       final JSONSerializationConfig jsc = JSC.create().setBracketRootValue(false);
       final Throwables.Function<? super T, String, IOException> toLine = it -> N.toJSON(it, jsc);
       stream.persist(toLine, header, outputFile);
       
      Parameters:
      toLine -
      file -
      Returns:
      Throws:
      IOException
    • persist

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

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

      @SequentialOnly @TerminalOp public abstract long persist(Throwables.Function<? super T,String,IOException> toLine, Writer writer) throws IOException
      toCSV:
       final JSONSerializationConfig jsc = JSC.create().setBracketRootValue(false);
       final Throwables.Function<? super T, String, IOException> toLine = it -> N.toJSON(it, jsc);
       stream.persist(toLine, header, outputFile);
       
      Parameters:
      toLine -
      writer -
      Returns:
      Throws:
      IOException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(Throwables.Function<? super T,String,IOException> toLine, String header, String tail, Writer writer) throws IOException
      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(Connection conn, String insertSQL, int batchSize, int batchInterval, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter) throws SQLException
      Parameters:
      conn -
      insertSQL -
      batchSize -
      batchInterval -
      stmtSetter -
      Returns:
      Throws:
      SQLException
    • persist

      @SequentialOnly @TerminalOp public abstract long persist(PreparedStatement stmt, int batchSize, int batchInterval, Throwables.BiConsumer<? super T,? super PreparedStatement,SQLException> stmtSetter) throws SQLException
      Parameters:
      stmt -
      batchSize -
      batchInterval -
      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 -
      Parameters:
      cls -
      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:
    • spsFlattMap

      @Beta @IntermediateOp public <R> Stream<R> spsFlattMap(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().flattMap(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:
    • spsFlattMap

      @Beta @IntermediateOp public <R> Stream<R> spsFlattMap(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).flattMap(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()
      Type Parameters:
      R -
      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:
    • spsFlattMap

      @Beta @IntermediateOp public <R> Stream<R> spsFlattMap(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.flattMap(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()
      Type Parameters:
      R -
      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:
    • spsFlattMapE

      @Beta @IntermediateOp public <R> Stream<R> spsFlattMapE(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().flattMapE(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:
    • spsFlattMapE

      @Beta @IntermediateOp public <R> Stream<R> spsFlattMapE(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().flattMapE(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:
    • 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:
    • flattMapE

      @Beta @ParallelSupported @IntermediateOp public <R> Stream<R> flattMapE(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)
      Type Parameters:
      R -
      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.
      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)
      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)
      Parameters:
      terminalAction - a terminal operation should be called.
      executor -
      Returns:
    • empty

      public static <T> Stream<T> empty()
    • just

      public static <T> Stream<T> just(T e)
    • 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)
    • of

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

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

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

      public static <K, V> Stream<Map.Entry<K,V>> of(Map<? extends K,? extends V> map)
    • of

      public static <T> Stream<T> of(Iterable<? extends T> iterable)
    • of

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

      public static <T> Stream<T> of(Stream<? extends T> stream)
    • of

      public static <T> Stream<T> of(Enumeration<? extends T> enumeration)
    • of

      public static Stream<Boolean> of(boolean[] a)
    • of

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

      public static Stream<Character> of(char[] a)
    • of

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

      public static Stream<Byte> of(byte[] a)
    • of

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

      public static Stream<Short> of(short[] a)
    • of

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

      public static Stream<Integer> of(int[] a)
    • of

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

      public static Stream<Long> of(long[] a)
    • of

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

      public static Stream<Float> of(float[] a)
    • of

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

      public static Stream<Double> of(double[] a)
    • of

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

      public static <T> Stream<T> of(u.Optional<T> op)
    • of

      public static <T> Stream<T> of(Optional<T> op)
    • ofKeys

      public static <K> Stream<K> ofKeys(Map<? extends K,?> map)
    • ofKeys

      public static <K, V> Stream<K> ofKeys(Map<? extends K,? extends V> map, Predicate<? super V> valueFilter)
    • ofKeys

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

      public static <V> Stream<V> ofValues(Map<?,? extends V> map)
    • ofValues

      public static <K, V> Stream<V> ofValues(Map<? extends K,? extends V> map, Predicate<? super K> keyFilter)
    • ofValues

      public static <K, V> Stream<V> ofValues(Map<? extends K,? extends V> map, BiPredicate<? super K,? super V> filter)
    • from

      @Beta public static <T> Stream<T> from(Supplier<? extends Collection<T>> supplier)
      Lazy evaluation.
      This is equal to: Stream.just(supplier).flattMap(it -> it.get()).
      Parameters:
      supplier -
      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)
    • range

      public static Stream<Integer> range(int startInclusive, int endExclusive, int by)
    • range

      public static Stream<Long> range(long startInclusive, long endExclusive)
    • range

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

      public static Stream<Integer> rangeClosed(int startInclusive, int endInclusive)
    • rangeClosed

      public static Stream<Integer> rangeClosed(int startInclusive, int endInclusive, int by)
    • rangeClosed

      public static Stream<Long> rangeClosed(long startInclusive, long endInclusive)
    • rangeClosed

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

      public static Stream<String> split(CharSequence str, CharSequence delimiter)
    • flatten

      public static <T> Stream<T> flatten(Collection<? extends Collection<? extends T>> c)
    • flatten

      public static <T> Stream<T> flatten(T[][] a)
    • flatten

      public static <T> Stream<T> flatten(T[][] a, boolean vertically)
    • flatten

      public static <T> Stream<T> flatten(T[][] a, T valueForNone, boolean vertically)
    • flatten

      public static <T> Stream<T> flatten(T[][][] a)
    • repeat

      public static <T> Stream<T> repeat(T element, long n)
    • iterate

      public static <T> Stream<T> iterate(BooleanSupplier hasNext, Supplier<? extends T> next)
    • 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.

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

      public static <T> Stream<T> iterate(T init, Predicate<? super T> hasNext, UnaryOperator<T> f)
      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)
    • generate

      public static <T> Stream<T> generate(Supplier<T> supplier)
    • interval

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

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

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

      public static <T> Stream<T> interval(long intervalInMillis, LongFunction<T> s)
    • interval

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

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

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

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

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

      public static Stream<String> lines(Path path, Charset charset) throws UncheckedIOException
      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
      Throws:
      UncheckedIOException
    • listFiles

      public static Stream<File> listFiles(File parentPath, boolean recursively) throws UncheckedIOException
      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);
       
       
      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("==================");
       
       
      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)
    • concat

      @SafeVarargs public static <T> Stream<T> concat(Iterable<? extends T>... a)
    • concat

      @SafeVarargs public static <T> Stream<T> concat(Iterator<? extends T>... a)
    • concat

      @SafeVarargs public static <T> Stream<T> concat(Stream<? extends T>... a)
    • concat

      public static <T> Stream<T> concat(Collection<? extends Stream<? extends T>> c)
    • concatIterables

      @Beta public static <T> Stream<T> concatIterables(Collection<? extends Iterable<? extends T>> c)
    • concatIterators

      @Beta public static <T> Stream<T> concatIterators(Collection<? extends Iterator<? extends T>> c)
    • parallelConcat

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

      public static <T> Stream<T> parallelConcat(Iterable<? extends T>[] a, int readThreadNum, int bufferSize)
      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)
      Parameters:
      a -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Iterator<? extends T>[] a, int readThreadNum, int bufferSize)
      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)
      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.
      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)
      Parameters:
      c -
      Returns:
    • parallelConcat

      public static <T> Stream<T> parallelConcat(Collection<? extends Stream<? extends T>> c, int readThreadNum)
      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.
      Parameters:
      a -
      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)
      Parameters:
      c -
      Returns:
    • parallelConcatIterables

      @Beta public static <T> Stream<T> parallelConcatIterables(Collection<? extends Iterable<? extends T>> c, int readThreadNum)
      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.
      Parameters:
      a -
      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)
      Parameters:
      c -
      Returns:
    • parallelConcatIterators

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

      public static <T> Stream<T> parallelConcatIterators(Collection<? extends Iterator<? extends T>> c, int readThreadNum, int bufferSize)
      Parameters:
      a -
      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<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(char[] a, char[] b, char[] c, CharTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharIterator c, CharTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharStream a, CharStream b, CharBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(CharStream a, CharStream b, CharStream c, CharTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends CharStream> c, CharNFunction<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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(char[] a, char[] b, char valueForNoneA, char valueForNoneB, CharBiFunction<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(byte[] a, byte[] b, byte[] c, ByteTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteIterator c, ByteTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteStream c, ByteTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends ByteStream> c, ByteNFunction<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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(byte[] a, byte[] b, byte valueForNoneA, byte valueForNoneB, ByteBiFunction<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(short[] a, short[] b, short[] c, ShortTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortIterator c, ShortTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortStream c, ShortTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends ShortStream> c, ShortNFunction<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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(short[] a, short[] b, short valueForNoneA, short valueForNoneB, ShortBiFunction<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(int[] a, int[] b, int[] c, IntTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntIterator c, IntTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntStream a, IntStream b, IntBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(IntStream a, IntStream b, IntStream c, IntTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends IntStream> c, IntNFunction<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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(int[] a, int[] b, int valueForNoneA, int valueForNoneB, IntBiFunction<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(long[] a, long[] b, long[] c, LongTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongIterator c, LongTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongStream a, LongStream b, LongBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(LongStream a, LongStream b, LongStream c, LongTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends LongStream> c, LongNFunction<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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(long[] a, long[] b, long valueForNoneA, long valueForNoneB, LongBiFunction<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(float[] a, float[] b, float[] c, FloatTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatIterator c, FloatTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatStream c, FloatTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends FloatStream> c, FloatNFunction<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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(float[] a, float[] b, float valueForNoneA, float valueForNoneB, FloatBiFunction<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(double[] a, double[] b, double[] c, DoubleTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleIterator c, DoubleTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleBiFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleStream c, DoubleTriFunction<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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <R> Stream<R> zip(Collection<? extends DoubleStream> c, DoubleNFunction<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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zip

      public static <R> Stream<R> zip(double[] a, double[] b, double valueForNoneA, double valueForNoneB, DoubleBiFunction<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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<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.
      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,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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <A, B, C, R> Stream<R> zip(A[] a, B[] b, C[] c, TriFunction<? super A,? super B,? super C,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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Iterable<? extends A> a, Iterable<? extends B> b, BiFunction<? super A,? super B,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.
      Parameters:
      a -
      b -
      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,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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,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.
      Parameters:
      a -
      b -
      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,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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <A, B, R> Stream<R> zip(Stream<? extends A> a, Stream<? extends B> b, BiFunction<? super A,? super B,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.
      Parameters:
      a -
      b -
      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,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.
      Parameters:
      a -
      b -
      Returns:
    • zip

      public static <T, R> Stream<R> zip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,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.
      Parameters:
      c -
      zipFunction -
      Returns:
    • zipIterables

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

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

      public static <A, B, R> Stream<R> zip(A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,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.
      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,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.
      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,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.
      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,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.
      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,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.
      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,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.
      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,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.
      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,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.
      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>,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.
      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>,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>,R> zipFunction)
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., 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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      zipFunction -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      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,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(..., 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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      c -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZip

      public static <A, B, R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, BiFunction<? super A,? super B,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., 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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      c -
      zipFunction -
      Returns:
    • parallelZip

      public static <T, R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      zipFunction -
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      valueForNoneA -
      valueForNoneB -
      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, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      c -
      valueForNoneA -
      valueForNoneB -
      valueForNoneC -
      zipFunction -
      bufferSize -
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      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>,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(..., 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>,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(..., 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>,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(..., 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>,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(..., 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>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      iterators -
      zipFunction -
      Returns:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, Function<? super List<? extends T>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      a -
      b -
      iterators -
      zipFunction -
      bufferSize -
      Returns:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, List<? extends T> valuesForNone, Function<? super List<? extends T>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      iterators -
      valuesForNone -
      zipFunction -
      Returns:
    • parallelZipIterators

      public static <T, R> Stream<R> parallelZipIterators(Collection<? extends Iterator<? extends T>> iterators, List<? extends T> valuesForNone, Function<? super List<? extends T>,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(..., Pair::of/Triple::of/Fn.identity()).parallel().map(zipFunction)...
      Parameters:
      iterators -
      valuesForNone -
      zipFunction -
      bufferSize -
      Returns:
    • merge

      public static <T> Stream<T> merge(T[] a, T[] b, BiFunction<? super T,? super T,MergeResult> nextSelector)
      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)
      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)
      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)
      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)
      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)
      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)
      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)
    • merge

      public static <T> Stream<T> merge(Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
      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.
      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.
      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.
      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.
      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 - in current stream(not upstream or origin source). It starts from 0.
      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>>
      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>>
    • 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>>
      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>>
      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>>
    • 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>>
    • 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>>
    • 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>>
    • 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>>
    • __

      public <SS extends BaseStream> SS __(Function<? super Stream<T>,? extends SS> transfer)
      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>>
    • 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>>
    • 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>>
    • 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>>
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(BaseStream.Splitor splitor)
      Description copied from interface: BaseStream
      Consider using sps(ParallelSettings, Function) if only next operation need to be parallelized. For example:
       stream.parallel(splitor).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(splitor), s -> s.map(f)).filter(p)...;
       // Or switch the stream back sequential stream if don't use "sps".
       stream.parallel(splitor).map(f).sequential().filter(p)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(ParallelSettings, 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, 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 - Default value is the number of cpu-cores. Steps/operations will be executed sequentially if maxThreadNum is 1.
      splitor - The target array is split by ranges for multiple threads if splitor is splitor.ARRAY and target stream composed by array. It looks like:
      
       for (int i = 0; i < maxThreadNum; i++) {
           final int sliceIndex = i;
      
           futureList.add(asyncExecutor.execute(new Runnable() {
               public void run() {
                   int cursor = fromIndex + sliceIndex * sliceSize;
                   final int to = toIndex - cursor > sliceSize ? cursor + sliceSize : toIndex;
                   while (cursor < to) {
                       action.accept(elements[cursor++]);
                   }
              }
          }));
       }
       
      Otherwise, each thread will get the elements from the target array/iterator in the stream one by one with the target array/iterator synchronized. It looks like:
      
       for (int i = 0; i < maxThreadNum; i++) {
           futureList.add(asyncExecutor.execute(new Runnable() {
               public void run() {
                   T next = null;
      
                   while (true) {
                       synchronized (elements) {
                           if (cursor.intValue() < toIndex) {
                               next = elements[cursor.getAndIncrement()];
                           } else {
                               break;
                           }
                       }
      
                       action.accept(next);
                   }
               }
           }));
       }
       
      Using splitor.ARRAY only when F (the per-element function (usually a lambda)) is very tiny and the cost of synchronization on the target array/iterator is too big to it. For the F involving IO or taking 'long' to complete, choose splitor.ITERATOR. Default value is splitor.ITERATOR.

      Consider using sps(ParallelSettings, Function) if only next operation need to be parallelized. For example:
       stream.parallel(maxThreadNum, splitor).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), s -> s.map(f)).filter(p)...;
       // Or switch the stream back sequential stream if don't use "sps".
       stream.parallel(maxThreadNum, splitor).map(f).sequential().filter(p)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(ParallelSettings, Function) is recommended in most of scenarios.
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(int maxThreadNum, Executor executor)
      Description copied from interface: BaseStream
      Consider using sps(ParallelSettings, Function) if only next operation need to be parallelized. For example:
       stream.parallel(maxThreadNum, 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,  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)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(ParallelSettings, 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>>
      executor - should be able to execute maxThreadNum * following up operations in parallel.
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(Executor executor)
      Description copied from interface: BaseStream
      Consider using sps(ParallelSettings, Function) if only next operation need to be parallelized. For example:
       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)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(ParallelSettings, 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:
      executor - should be able to execute maxThreadNum * following up operations in parallel.
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(int maxThreadNum, BaseStream.Splitor splitor, Executor executor)
      Description copied from interface: BaseStream
      Consider using sps(ParallelSettings, Function) if only next operation need to be parallelized. For example:
       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)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(ParallelSettings, 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>>
      executor - should be able to execute maxThreadNum * following up operations in parallel.
      Returns:
      See Also:
    • parallel

      public Stream<T> parallel(BaseStream.ParallelSettings ps)
      Description copied from interface: BaseStream
      Consider using sps(ParallelSettings, Function) if only next operation need to be parallelized. For example:
       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)...;
      
       
      In most scenarios, there could be only one operation need be parallelized in the stream. So sps(ParallelSettings, 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:
    • 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>>
      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>>
      Returns:
    • sps

      public <SS extends BaseStream> SS sps(BaseStream.ParallelSettings ps, 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(ps).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>>
      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>>
      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>>
    • 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