T
- the type of the stream elementspublic abstract class Stream<T>
extends java.lang.Object
Stream
and IntStream
:
int sum = widgets.stream()
.filter(w -> w.getColor() == RED)
.mapToInt(w -> w.getWeight())
.sum();
In this example, widgets
is a Collection<Widget>
. We create
a stream of Widget
objects via Collection.stream()
,
filter it to produce a stream containing only the red widgets, and then
transform it into a stream of int
values representing the weight of
each red widget. Then this stream is summed to produce a total weight.
In addition to Stream
, which is a stream of object references,
there are primitive specializations for IntStream
, LongStream
,
and DoubleStream
, all of which are referred to as "streams" and
conform to the characteristics and restrictions described here.
To perform a computation, stream
operations are composed into a
stream pipeline. A stream pipeline consists of a source (which
might be an array, a collection, a generator function, an I/O channel,
etc), zero or more intermediate operations (which transform a
stream into another stream, such as Stream#filter(Predicate)
), and a
terminal operation (which produces a result or side-effect, such
as BaseStream.count()
or Stream#forEach(Consumer)
).
Streams are lazy; computation on the source data is only performed when the
terminal operation is initiated, and source elements are consumed only
as needed.
Collections and streams, while bearing some superficial similarities,
have different goals. Collections are primarily concerned with the efficient
management of, and access to, their elements. By contrast, streams do not
provide a means to directly access or manipulate their elements, and are
instead concerned with declaratively describing their source and the
computational operations which will be performed in aggregate on that source.
However, if the provided stream operations do not offer the desired
functionality, the iterator()
and #spliterator()
operations
can be used to perform a controlled traversal.
A stream pipeline, like the "widgets" example above, can be viewed as
a query on the stream source. Unless the source was explicitly
designed for concurrent modification (such as a ConcurrentHashMap
),
unpredictable or erroneous behavior may result from modifying the stream
source while it is being queried.
Most stream operations accept parameters that describe user-specified
behavior, such as the lambda expression w -> w.getWeight()
passed to
mapToInt
in the example above. To preserve correct behavior,
these behavioral parameters:
Such parameters are always instances of a
functional interface such
as Function
, and are often lambda expressions or
method references. Unless otherwise specified these parameters must be
non-null.
A stream should be operated on (invoking an intermediate or terminal stream
operation) only once. This rules out, for example, "forked" streams, where
the same source feeds two or more pipelines, or multiple traversals of the
same stream. A stream implementation may throw IllegalStateException
if it detects that the stream is being reused. However, since some stream
operations may return their receiver rather than a new stream object, it may
not be possible to detect reuse in all cases.
Streams have a close()
method and implement AutoCloseable
,
but nearly all stream instances do not actually need to be closed after use.
Generally, only streams whose source is an IO channel (such as those returned
by Files.lines(Path, Charset)
) will require closing. Most streams
are backed by collections, arrays, or generating functions, which require no
special resource management. (If a stream does require closing, it can be
declared as a resource in a try
-with-resources statement.)
Stream pipelines may execute either sequentially or in
parallel. This
execution mode is a property of the stream. Streams are created
with an initial choice of sequential or parallel execution. (For example,
Collection.stream()
creates a sequential stream,
and Collection.parallelStream()
creates
a parallel one.) This choice of execution mode may be modified by the
sequential()
or parallel()
methods, and may be queried with
the isParallel()
method.
IntStream
,
LongStream
,
DoubleStream
,
java.util.streamModifier and Type | Class and Description |
---|---|
static class |
Stream.LAIO
LAIO = Loading All Intermediate Operations.
|
static class |
Stream.PSO
PSO = Parallel supported Operations.
|
static class |
Stream.SOO
SOO = Sequential Only Operations.
|
static class |
Stream.StreamEx<T> |
BaseStream.Splitor
Modifier and Type | Method and Description |
---|---|
<R> R |
__(Function<? super Stream<T>,R> transfer) |
abstract <U> boolean |
allMatch(U seed,
BiPredicate<? super T,? super U> predicate) |
abstract <U> boolean |
anyMatch(U seed,
BiPredicate<? super T,? super U> predicate) |
abstract Stream<T> |
append(java.util.Collection<? extends T> c) |
Stream<T> |
append(T... a) |
abstract OptionalDouble |
averageDouble(ToDoubleFunction<? super T> mapper) |
abstract OptionalDouble |
averageInt(ToIntFunction<? super T> mapper) |
abstract OptionalDouble |
averageLong(ToLongFunction<? super T> mapper) |
abstract <R> Stream<R> |
biMap(BiFunction<? super T,? super T,? extends R> mapper) |
abstract <R> Stream<R> |
biMap(BiFunction<? super T,? super T,? extends R> mapper,
boolean ignoreNotPaired)
Returns a stream consisting of the results of applying the given function
to the every two adjacent elements of this stream.
|
abstract Stream<T> |
cached(IntFunction<T[]> generator)
Returns a reusable stream which can be repeatedly used.
|
S |
carry(C action)
Same as
peek |
abstract Stream<java.util.List<T>> |
cartesianProduct(java.util.Collection<? extends java.util.Collection<? extends T>> cs) |
Stream<java.util.List<T>> |
cartesianProduct(java.util.Collection<? extends T>... cs) |
void |
close()
Closes this stream, causing all close handlers for this stream pipeline
to be called.
|
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.
|
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.
|
abstract <R,A> R |
collect(Collector<? super T,A,R> collector)
Performs a mutable
reduction operation on the elements of this stream using a
Collector . |
abstract <R,A> R |
collect(java.util.stream.Collector<? super T,A,R> collector) |
abstract <R> R |
collect(Supplier<R> supplier,
BiConsumer<R,? super T> accumulator)
The result will be merged by:
a.addAll(b) if result container is Collection/Multiset/LongMultiset/IntList/CharList/... ,
or a.putAll(b) if result container is Map/Multimap/Sheet ,
or a.append(b) if result container is StringBuilder when it's necessary in Parallel Stream. |
abstract <R> R |
collect(Supplier<R> supplier,
BiConsumer<R,? super T> accumulator,
BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
abstract <R,A,RR> RR |
collectAndThen(Collector<? super T,A,R> downstream,
Function<R,RR> finisher) |
abstract <R,A,RR> RR |
collectAndThen(java.util.stream.Collector<? super T,A,R> downstream,
Function<R,RR> finisher) |
abstract Stream<java.util.List<T>> |
combinations() |
abstract Stream<java.util.List<T>> |
combinations(int len) |
static <T> Stream<T> |
concat(java.util.Collection<? extends Stream<? extends T>> c) |
static <T> Stream<T> |
concat(java.util.Collection<? extends T>... a) |
static <T> Stream<T> |
concat(java.util.Iterator<? extends T>... a) |
static <T> Stream<T> |
concat(Stream<? extends T>... a) |
static <T> Stream<T> |
concat(T[]... a) |
static <T> Stream<T> |
concat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c) |
abstract boolean |
containsAll(java.util.Collection<? extends T> c) |
abstract boolean |
containsAll(T... a) |
abstract Stream<T> |
difference(Function<? super T,?> mapper,
java.util.Collection<?> c)
Except with the specified Collection by the values mapped by
mapper . |
abstract Stream<T> |
distinctBy(Function<? super T,?> keyExtractor)
Distinct by the value mapped from
keyExtractor
This method only run sequentially, even in parallel stream. |
abstract <U> Stream<T> |
dropWhile(U seed,
BiPredicate<? super T,? super U> predicate) |
static <T> Stream<T> |
empty() |
abstract <U> Stream<T> |
filter(U seed,
BiPredicate<? super T,? super U> predicate) |
OT |
findAny(P predicate)
Returns an
Optional describing some element of the stream, or an
empty Optional if the stream is empty. |
abstract <U> Nullable<T> |
findAny(U seed,
BiPredicate<? super T,? super U> predicate)
This method only run sequentially, even in parallel stream. |
abstract <U> Nullable<T> |
findFirst(U seed,
BiPredicate<? super T,? super U> predicate)
This method only run sequentially, even in parallel stream. |
abstract <U> Nullable<T> |
findFirstOrLast(Function<? super T,U> preFunc,
BiPredicate<? super T,? super U> predicateForFirst,
BiPredicate<? super T,? super U> predicateForLast)
This method only run sequentially, even in parallel stream. |
abstract <U> Nullable<T> |
findFirstOrLast(U seed,
BiPredicate<? super T,? super U> predicateForFirst,
BiPredicate<? super T,? super U> predicateForLast)
This method only run sequentially, even in parallel stream. |
abstract <U> Nullable<T> |
findLast(U seed,
BiPredicate<? super T,? super U> predicate)
This method only run sequentially, even in parallel stream. |
abstract <R> Stream<R> |
flatArray(Function<? super T,R[]> mapper) |
abstract <U,R> Stream<R> |
flatArray(U seed,
BiFunction<? super T,? super U,R[]> mapper) |
abstract <R> Stream<R> |
flatCollection(Function<? super T,? extends java.util.Collection<? extends R>> mapper) |
abstract <U,R> Stream<R> |
flatCollection(U seed,
BiFunction<? super T,? super U,? extends java.util.Collection<? extends R>> mapper) |
abstract <R> Stream<R> |
flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
|
abstract <U,R> Stream<R> |
flatMap(U seed,
BiFunction<? super T,? super U,? extends Stream<? extends R>> mapper) |
abstract ByteStream |
flatMapToByte(Function<? super T,? extends ByteStream> mapper) |
abstract CharStream |
flatMapToChar(Function<? super T,? extends CharStream> mapper) |
abstract DoubleStream |
flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
Returns an
DoubleStream consisting of the results of replacing
each element of this stream with the contents of a mapped stream produced
by applying the provided mapping function to each element. |
abstract <K,V> EntryStream<K,V> |
flatMapToEntry(Function<? super T,? extends Stream<? extends java.util.Map.Entry<K,V>>> mapper) |
abstract FloatStream |
flatMapToFloat(Function<? super T,? extends FloatStream> mapper) |
abstract IntStream |
flatMapToInt(Function<? super T,? extends IntStream> mapper)
Returns an
IntStream consisting of the results of replacing each
element of this stream with the contents of a mapped stream produced by
applying the provided mapping function to each element. |
abstract LongStream |
flatMapToLong(Function<? super T,? extends LongStream> mapper)
Returns an
LongStream consisting of the results of replacing each
element of this stream with the contents of a mapped stream produced by
applying the provided mapping function to each element. |
abstract ShortStream |
flatMapToShort(Function<? super T,? extends ShortStream> mapper) |
abstract <R> R |
forEach(R seed,
BiFunction<R,? super T,R> accumulator,
BiPredicate<? super R,? super T> conditionToBreak)
Execute
accumulator on each element till true is returned by conditionToBreak
This method only run sequentially, even in parallel stream. |
abstract void |
forEachPair(BiConsumer<? super T,? super T> action) |
abstract void |
forEachPair(BiConsumer<? super T,? super T> action,
int increment)
Slide with
windowSize = 2 and the specified increment , then consume by the specified mapper . |
abstract void |
forEachTriple(TriConsumer<? super T,? super T,? super T> action) |
abstract void |
forEachTriple(TriConsumer<? super T,? super T,? super T> action,
int increment)
Slide with
windowSize = 3 and the specified increment , then consume by the specified mapper . |
abstract <U> Stream<Pair<T,U>> |
fullJoin(java.util.Collection<U> b,
BiPredicate<? super T,? super U> predicate)
The time complexity is O(n * m) : n is the size of this
Stream and m is the size of specified collection b . |
abstract <U> Stream<Pair<T,U>> |
fullJoin(java.util.Collection<U> b,
Function<? super T,?> leftKeyMapper,
Function<? super U,?> rightKeyMapper)
The time complexity is O(n + m) : n is the size of this
Stream and m is the size of specified collection b . |
static <T> Stream<T> |
generate(Supplier<T> s) |
abstract <K> Stream<java.util.Map.Entry<K,java.util.List<T>>> |
groupBy(Function<? super T,? extends K> classifier) |
abstract <K,A,D> Stream<java.util.Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream) |
abstract <K,A,D> Stream<java.util.Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream,
Supplier<java.util.Map<K,D>> mapFactory) |
abstract <K,U> Stream<java.util.Map.Entry<K,java.util.List<U>>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper) |
abstract <K,U> Stream<java.util.Map.Entry<K,U>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction) |
abstract <K,U> Stream<java.util.Map.Entry<K,U>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<java.util.Map<K,U>> mapFactory) |
abstract <K,U> Stream<java.util.Map.Entry<K,java.util.List<U>>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Supplier<java.util.Map<K,java.util.List<U>>> mapFactory) |
abstract <K> Stream<java.util.Map.Entry<K,java.util.List<T>>> |
groupBy(Function<? super T,? extends K> classifier,
Supplier<java.util.Map<K,java.util.List<T>>> mapFactory) |
abstract <K> EntryStream<K,java.util.List<T>> |
groupByToEntry(Function<? super T,? extends K> classifier) |
abstract <K,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream) |
abstract <K,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream,
Supplier<java.util.Map<K,D>> mapFactory) |
abstract <K,U> EntryStream<K,java.util.List<U>> |
groupByToEntry(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper) |
abstract <K,U> EntryStream<K,U> |
groupByToEntry(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction) |
abstract <K,U> EntryStream<K,U> |
groupByToEntry(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<java.util.Map<K,U>> mapFactory) |
abstract <K,U> EntryStream<K,java.util.List<U>> |
groupByToEntry(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Supplier<java.util.Map<K,java.util.List<U>>> mapFactory) |
abstract <K> EntryStream<K,java.util.List<T>> |
groupByToEntry(Function<? super T,? extends K> classifier,
Supplier<java.util.Map<K,java.util.List<T>>> mapFactory) |
abstract <K> java.util.Map<K,java.util.List<T>> |
groupTo(Function<? super T,? extends K> classifier) |
abstract <K,U> java.util.Map<K,java.util.List<U>> |
groupTo(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper) |
abstract <K,U,M extends java.util.Map<K,java.util.List<U>>> |
groupTo(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper,
Supplier<M> mapFactory) |
abstract <K,M extends java.util.Map<K,java.util.List<T>>> |
groupTo(Function<? super T,? extends K> classifier,
Supplier<M> mapFactory) |
abstract boolean |
hasDuplicates() |
abstract Nullable<T> |
head()
Head and tail should be used by pair.
|
abstract Stream<T> |
head2()
Head2 and tail2 should be used by pair.
|
abstract Pair<Nullable<T>,Stream<T>> |
headAndTail() |
abstract Pair<Stream<T>,Nullable<T>> |
headAndTail2()
All elements will be loaded to memory. |
abstract <U> Stream<Pair<T,U>> |
innerJoin(java.util.Collection<U> b,
BiPredicate<? super T,? super U> predicate)
The time complexity is O(n * m) : n is the size of this
Stream and m is the size of specified collection b . |
abstract <U> Stream<Pair<T,U>> |
innerJoin(java.util.Collection<U> b,
Function<? super T,?> leftKeyMapper,
Function<? super U,?> rightKeyMapper)
The time complexity is O(n + m) : n is the size of this
Stream and m is the size of specified collection b . |
abstract Stream<T> |
intersection(Function<? super T,?> mapper,
java.util.Collection<?> c)
Intersect with the specified Collection by the values mapped by
mapper . |
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 run sequentially, even in parallel stream. |
static <T> Stream<T> |
interval(long intervalInMillis,
LongFunction<T> s) |
static <T> Stream<T> |
interval(long delayInMillis,
long intervalInMillis,
LongFunction<T> s) |
static <T> Stream<T> |
interval(long delayInMillis,
long intervalInMillis,
Supplier<T> s) |
static <T> Stream<T> |
interval(long delay,
long interval,
java.util.concurrent.TimeUnit unit,
LongFunction<T> s) |
static <T> Stream<T> |
interval(long delay,
long interval,
java.util.concurrent.TimeUnit unit,
Supplier<T> s) |
static <T> Stream<T> |
interval(long intervalInMillis,
Supplier<T> s) |
boolean |
isParallel()
Returns whether this stream, if a terminal operation were to be executed,
would execute in parallel.
|
static <T> Stream<T> |
iterate(Supplier<java.lang.Boolean> hasNext,
Supplier<? extends T> next) |
static <T> Stream<T> |
iterate(T seed,
Predicate<T> hasNext,
UnaryOperator<T> f) |
static <T> Stream<T> |
iterate(T seed,
Supplier<java.lang.Boolean> hasNext,
UnaryOperator<T> f)
Returns a sequential ordered
Stream produced by iterative
application of a function f to an initial element seed ,
producing a Stream consisting of seed , f(seed) ,
f(f(seed)) , etc. |
static <T> Stream<T> |
iterate(T seed,
UnaryOperator<T> f) |
ObjIterator<T> |
iterator()
Returns an iterator for the elements of this stream.
|
static <T> Stream<T> |
just(T a) |
abstract Nullable<T> |
kthLargest(int k,
java.util.Comparator<? super T> comparator) |
abstract Stream<T> |
last(int n)
A queue with size up to
n will be maintained to filter out the last n elements. |
abstract <U> Stream<Pair<T,U>> |
leftJoin(java.util.Collection<U> b,
BiPredicate<? super T,? super U> predicate)
The time complexity is O(n * m) : n is the size of this
Stream and m is the size of specified collection b . |
abstract <U> Stream<Pair<T,U>> |
leftJoin(java.util.Collection<U> b,
Function<? super T,?> leftKeyMapper,
Function<? super U,?> rightKeyMapper)
The time complexity is O(n + m) : n is the size of this
Stream and m is the size of specified collection b . |
static Stream<java.io.File> |
list(java.io.File parentPath) |
static Stream<java.io.File> |
list(java.io.File parentPath,
boolean recursively) |
abstract <R> Stream<R> |
map(Function<? super T,? extends R> mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
abstract <U,R> Stream<R> |
map(U seed,
BiFunction<? super T,? super U,? extends R> mapper) |
abstract Stream<T> |
mapFirst(Function<? super T,? extends T> mapperForFirst) |
abstract <R> Stream<R> |
mapFirstOrElse(Function<? super T,? extends R> mapperForFirst,
Function<? super T,? extends R> mapperForElse) |
abstract Stream<T> |
mapLast(Function<? super T,? extends T> mapperForLast) |
abstract <R> Stream<R> |
mapLastOrElse(Function<? super T,? extends R> mapperForLast,
Function<? super T,? extends R> mapperForElse) |
abstract ByteStream |
mapToByte(ToByteFunction<? super T> mapper) |
abstract CharStream |
mapToChar(ToCharFunction<? super T> mapper) |
abstract DoubleStream |
mapToDouble(ToDoubleFunction<? super T> mapper)
Returns a
DoubleStream consisting of the results of applying the
given function to the elements of this stream. |
abstract <K,V> EntryStream<K,V> |
mapToEntry(Function<? super T,? extends java.util.Map.Entry<K,V>> mapper) |
abstract <K,V> EntryStream<K,V> |
mapToEntry(Function<? super T,K> keyMapper,
Function<? super T,V> valueMapper) |
abstract <K,V> EntryStream<K,V> |
mapToEntryER(Function<? super T,K> keyMapper,
Function<? super T,V> valueMapper)
To reduce the memory footprint, Only one instance of
Map.Entry is created,
and the same entry instance is returned and set with different keys/values during iteration of the returned stream. |
abstract FloatStream |
mapToFloat(ToFloatFunction<? super T> mapper) |
abstract IntStream |
mapToInt(ToIntFunction<? super T> mapper)
Returns an
IntStream consisting of the results of applying the
given function to the elements of this stream. |
abstract LongStream |
mapToLong(ToLongFunction<? super T> mapper)
Returns a
LongStream consisting of the results of applying the
given function to the elements of this stream. |
abstract ShortStream |
mapToShort(ToShortFunction<? super T> mapper) |
abstract Nullable<T> |
max(java.util.Comparator<? super T> comparator)
Returns the maximum element of this stream according to the provided
Comparator . |
Nullable<T> |
maxBy(Function<? super T,? extends java.lang.Comparable> keyExtractor) |
int |
maxThreadNum()
Return the underlying
maxThreadNum if the stream is parallel, otherwise 1 is returned. |
S |
maxThreadNum(int maxThreadNum)
Returns a parallel stream with the specified
maxThreadNum . |
static <T> Stream<T> |
merge(java.util.Collection<? extends Stream<? extends T>> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(java.util.Collection<? extends T> a,
java.util.Collection<? extends T> b,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(java.util.Collection<? extends T> a,
java.util.Collection<? extends T> b,
java.util.Collection<? extends T> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(java.util.Iterator<? extends T> a,
java.util.Iterator<? extends T> b,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(java.util.Iterator<? extends T> a,
java.util.Iterator<? extends T> b,
java.util.Iterator<? extends T> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
abstract Stream<T> |
merge(Stream<? extends T> b,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(Stream<? extends T> a,
Stream<? extends T> b,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(Stream<? extends T> a,
Stream<? extends T> b,
Stream<? extends T> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(T[] a,
T[] b,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge(T[] a,
T[] b,
T[] c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
merge2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
abstract Nullable<T> |
min(java.util.Comparator<? super T> comparator)
Returns the minimum element of this stream according to the provided
Comparator . |
Nullable<T> |
minBy(Function<? super T,? extends java.lang.Comparable> keyExtractor) |
abstract <U> boolean |
noneMatch(U seed,
BiPredicate<? super T,? super U> predicate) |
static <T> Stream<T> |
observe(java.util.concurrent.BlockingQueue<T> queue,
Duration duration) |
static <T> Stream<T> |
observe(java.util.concurrent.BlockingQueue<T> queue,
Predicate<? super T> isLast,
long maxWaitIntervalInMillis) |
static Stream<java.lang.Boolean> |
of(boolean[] a) |
static Stream<java.lang.Boolean> |
of(boolean[] a,
int fromIndex,
int toIndex) |
static Stream<java.lang.Byte> |
of(byte[] a) |
static Stream<java.lang.Byte> |
of(byte[] a,
int fromIndex,
int toIndex) |
static Stream<java.lang.Character> |
of(char[] a) |
static Stream<java.lang.Character> |
of(char[] a,
int fromIndex,
int toIndex) |
static <T> Stream<T> |
of(java.lang.Class<T> targetClass,
java.sql.ResultSet resultSet) |
static <T> Stream<T> |
of(java.util.Collection<? extends T> c)
Returns a sequential, stateful and immutable
Stream . |
static <T> Stream<T> |
of(java.util.Collection<? extends T> c,
int startIndex,
int endIndex)
Returns a sequential, stateful and immutable
Stream . |
static Stream<java.lang.Double> |
of(double[] a) |
static Stream<java.lang.Double> |
of(double[] a,
int fromIndex,
int toIndex) |
static Try<Stream<java.lang.String>> |
of(java.io.File file) |
static Try<Stream<java.lang.String>> |
of(java.io.File file,
java.nio.charset.Charset charset) |
static Stream<java.lang.Float> |
of(float[] a) |
static Stream<java.lang.Float> |
of(float[] a,
int fromIndex,
int toIndex) |
static Stream<java.lang.Integer> |
of(int[] a) |
static Stream<java.lang.Integer> |
of(int[] a,
int fromIndex,
int toIndex) |
static <T> Stream<T> |
of(java.util.Iterator<? extends T> iterator)
Returns a sequential, stateful and immutable
Stream . |
static Stream<java.lang.Long> |
of(long[] a) |
static Stream<java.lang.Long> |
of(long[] a,
int fromIndex,
int toIndex) |
static <K,V> Stream<java.util.Map.Entry<K,V>> |
of(java.util.Map<K,V> map) |
static Try<Stream<java.lang.String>> |
of(java.nio.file.Path path) |
static Try<Stream<java.lang.String>> |
of(java.nio.file.Path path,
java.nio.charset.Charset charset) |
static Stream<java.lang.String> |
of(java.io.Reader reader)
It's user's responsibility to close the input
reader after the stream is finished. |
static Stream<java.lang.Object[]> |
of(java.sql.ResultSet resultSet)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static Stream<java.lang.Short> |
of(short[] a) |
static Stream<java.lang.Short> |
of(short[] a,
int fromIndex,
int toIndex) |
static <T> Stream<T> |
of(java.util.stream.Stream<T> stream) |
static <T> Stream<T> |
of(Supplier<java.util.Collection<? extends T>> supplier)
Lazy evaluation.
|
static <T> Stream<T> |
of(T... a) |
static <T> Stream<T> |
of(T[] a,
int startIndex,
int endIndex)
Returns a sequential, stateful and immutable
Stream . |
static <T> Stream<T> |
ofNullable(T t) |
abstract Stream<java.util.List<T>> |
orderedPermutations() |
abstract Stream<java.util.List<T>> |
orderedPermutations(java.util.Comparator<? super T> comparator) |
S |
parallel()
Returns an equivalent stream that is parallel.
|
S |
parallel(BaseStream.Splitor splitor)
Returns an equivalent stream that is parallel.
|
S |
parallel(int maxThreadNum)
Returns an equivalent stream that is parallel.
|
static <T> Stream<T> |
parallelConcat(java.util.Collection<? extends Stream<? extends T>> c)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T> Stream<T> |
parallelConcat(java.util.Collection<? extends Stream<? extends T>> c,
int readThreadNum)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T> Stream<T> |
parallelConcat(java.util.Collection<? extends Stream<? extends T>> c,
int readThreadNum,
int queueSize)
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterators in parallel.
|
static <T> Stream<T> |
parallelConcat(java.util.Iterator<? extends T>... a)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T> Stream<T> |
parallelConcat(java.util.Iterator<? extends T>[] a,
int readThreadNum,
int queueSize)
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterators in parallel.
|
static <T> Stream<T> |
parallelConcat(Stream<? extends T>... a)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T> Stream<T> |
parallelConcat(Stream<? extends T>[] a,
int readThreadNum,
int queueSize)
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterators in parallel.
|
static <T> Stream<T> |
parallelConcat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T> Stream<T> |
parallelConcat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
int readThreadNum)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T> Stream<T> |
parallelConcat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
int readThreadNum,
int queueSize)
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterators in parallel.
|
static <T> Stream<T> |
parallelMerge(java.util.Collection<? extends Stream<? extends T>> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
parallelMerge(java.util.Collection<? extends Stream<? extends T>> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector,
int maxThreadNum) |
static <T> Stream<T> |
parallelMerge2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
static <T> Stream<T> |
parallelMerge2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector,
int maxThreadNum) |
static <T,R> Stream<R> |
parallelZip(java.util.Collection<? extends Stream<? extends T>> c,
Function<? super java.util.List<? extends T>,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T,R> Stream<R> |
parallelZip(java.util.Collection<? extends Stream<? extends T>> c,
Function<? super java.util.List<? extends T>,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T,R> Stream<R> |
parallelZip(java.util.Collection<? extends Stream<? extends T>> c,
java.lang.Object[] valuesForNone,
Function<? super java.util.List<? extends T>,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T,R> Stream<R> |
parallelZip(java.util.Collection<? extends Stream<? extends T>> c,
java.lang.Object[] valuesForNone,
Function<? super java.util.List<? extends T>,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
A valueForNoneA,
B valueForNoneB,
BiFunction<? super A,? super B,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
A valueForNoneA,
B valueForNoneB,
BiFunction<? super A,? super B,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
BiFunction<? super A,? super B,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
BiFunction<? super A,? super B,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,C,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
java.util.Iterator<? extends C> c,
A valueForNoneA,
B valueForNoneB,
C valueForNoneC,
TriFunction<? super A,? super B,? super C,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,C,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
java.util.Iterator<? extends C> c,
A valueForNoneA,
B valueForNoneB,
C valueForNoneC,
TriFunction<? super A,? super B,? super C,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,C,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
java.util.Iterator<? extends C> c,
TriFunction<? super A,? super B,? super C,R> zipFunction) |
static <A,B,C,R> Stream<R> |
parallelZip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
java.util.Iterator<? extends C> c,
TriFunction<? super A,? super B,? super C,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,R> Stream<R> |
parallelZip(Stream<A> a,
Stream<B> b,
A valueForNoneA,
B valueForNoneB,
BiFunction<? super A,? super B,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
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 queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,R> Stream<R> |
parallelZip(Stream<A> a,
Stream<B> b,
BiFunction<? super A,? super B,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <A,B,R> Stream<R> |
parallelZip(Stream<A> a,
Stream<B> b,
BiFunction<? super A,? super B,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
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)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
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 queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
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) |
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 queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T,R> Stream<R> |
parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
Function<? super java.util.List<? extends T>,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T,R> Stream<R> |
parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
Function<? super java.util.List<? extends T>,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T,R> Stream<R> |
parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
java.lang.Object[] valuesForNone,
Function<? super java.util.List<? extends T>,R> zipFunction)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
static <T,R> Stream<R> |
parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
java.lang.Object[] valuesForNone,
Function<? super java.util.List<? extends T>,R> zipFunction,
int queueSize)
Put the stream in try-catch to stop the back-end reading thread if error happens
try (Stream |
abstract Optional<java.util.Map<com.landawn.abacus.util.Percentage,T>> |
percentiles(java.util.Comparator<? super T> comparator) |
abstract Stream<java.util.List<T>> |
permutations() |
abstract long |
persist(java.sql.Connection conn,
java.lang.String insertSQL,
int batchSize,
int batchInterval,
Try.BiConsumer<? super java.sql.PreparedStatement,? super T,java.sql.SQLException> stmtSetter) |
abstract long |
persist(java.io.File file,
Function<? super T,java.lang.String> toLine) |
abstract long |
persist(java.io.OutputStream os,
Function<? super T,java.lang.String> toLine) |
abstract long |
persist(java.sql.PreparedStatement stmt,
int batchSize,
int batchInterval,
Try.BiConsumer<? super java.sql.PreparedStatement,? super T,java.sql.SQLException> stmtSetter) |
abstract long |
persist(java.io.Writer writer,
Function<? super T,java.lang.String> toLine) |
abstract Stream<T> |
prepend(java.util.Collection<? extends T> c) |
Stream<T> |
prepend(T... a) |
void |
println() |
abstract Stream<T> |
queued() |
abstract Stream<T> |
queued(int queueSize)
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterator asynchronously.
|
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. |
abstract Nullable<T> |
reduce(BinaryOperator<T> accumulator)
Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
Optional describing the reduced value,
if any. |
abstract T |
reduce(T identity,
BinaryOperator<T> accumulator)
Performs a reduction on the
elements of this stream, using the provided identity value and an
associative
accumulation function, and returns the reduced value.
|
abstract <U> U |
reduce(U identity,
BiFunction<U,? super T,U> accumulator)
The result will be merged by:
a.addAll(b) if result container is Collection/Multiset/LongMultiset/IntList/CharList/... ,
or a.putAll(b) if result container is Map/Multimap/Sheet ,
or a.append(b) if result container is StringBuilder ,
or N.concat(a, b) if result container is array: boolean[]/char[]/int[]/.../Object[] when it's necessary in Parallel Stream. |
abstract <U> U |
reduce(U identity,
BiFunction<U,? super T,U> accumulator,
BinaryOperator<U> combiner)
Performs a reduction on the
elements of this stream, using the provided identity, accumulation and
combining functions.
|
abstract <U> Stream<T> |
removeIf(U seed,
BiPredicate<? super T,? super U> predicate) |
abstract <U> Stream<T> |
removeIf(U seed,
BiPredicate<? super T,? super U> predicate,
Consumer<? super T> consumer) |
abstract <U> Stream<T> |
removeWhile(U seed,
BiPredicate<? super T,? super U> predicate,
Consumer<? super T> consumer)
Returns a stream consisting of the remaining elements of this stream
after removing and consuming until the specified
predicate return false. |
static <T> Stream<T> |
repeat(T element,
long n) |
abstract <U> Stream<Pair<T,U>> |
rightJoin(java.util.Collection<U> b,
BiPredicate<? super T,? super U> predicate)
The time complexity is O(n * m) : n is the size of this
Stream and m is the size of specified collection b . |
abstract <U> Stream<Pair<T,U>> |
rightJoin(java.util.Collection<U> b,
Function<? super T,?> leftKeyMapper,
Function<? super U,?> rightKeyMapper)
The time complexity is O(n + m) : n is the size of this
Stream and m is the size of specified collection b . |
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 seed and next element of the current stream. |
abstract <R> Stream<R> |
scan(R seed,
BiFunction<? super R,? super T,R> accumulator)
Returns a
Stream produced by iterative application of a accumulation function
to an initial element seed and next element of the current stream. |
<U> Stream<U> |
select(java.lang.Class<U> targetType)
Returns a stream consisting of the elements in this stream which are
instances of given class.
|
S |
sequential()
Returns an equivalent stream that is sequential.
|
abstract Stream<T> |
skipLast(int n)
A queue with size up to
n will be maintained to filter out the last n elements. |
abstract Stream<T> |
skipNull() |
Stream<S> |
sliding(int windowSize) |
abstract <R> Stream<R> |
slidingMap(BiFunction<? super T,? super T,R> mapper) |
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 . |
abstract <R> Stream<R> |
slidingMap(TriFunction<? super T,? super T,? super T,R> mapper) |
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 . |
abstract Stream<java.util.List<T>> |
slidingToList(int windowSize) |
abstract Stream<java.util.List<T>> |
slidingToList(int windowSize,
int increment) |
abstract Stream<T> |
sorted(java.util.Comparator<? super T> comparator)
Returns a stream consisting of the elements of this stream, sorted
according to the provided
Comparator . |
abstract Stream<T> |
sortedBy(Function<? super T,? extends java.lang.Comparable> keyExtractor) |
static Stream<java.lang.String> |
split(java.lang.String str,
char delimiter)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
|
static Stream<java.lang.String> |
split(java.lang.String str,
char delimiter,
boolean trim)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
|
static Stream<java.lang.String> |
split(java.lang.String str,
java.lang.String delimiter)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
|
static Stream<java.lang.String> |
split(java.lang.String str,
java.lang.String delimiter,
boolean trim)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
|
BaseStream.Splitor |
splitor()
Return the underlying
splitor if the stream is parallel, otherwise the default value splitor.ITERATOR is returned. |
S |
splitor(BaseStream.Splitor splitor)
Returns a parallel stream with the specified
splitor . |
abstract Stream<java.util.List<T>> |
splitToList(int size)
Returns Stream of Stream with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
|
abstract <U> Stream<java.util.List<T>> |
splitToList(U seed,
BiPredicate<? super T,? super U> predicate,
Consumer<? super U> seedUpdate)
Split the stream by the specified predicate.
|
abstract Stream<java.util.Set<T>> |
splitToSet(int size)
Returns Stream of Stream with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
|
abstract <U> Stream<java.util.Set<T>> |
splitToSet(U seed,
BiPredicate<? super T,? super U> predicate,
Consumer<? super U> seedUpdate)
Split the stream by the specified predicate.
|
abstract double |
sumDouble(ToDoubleFunction<? super T> mapper) |
abstract int |
sumInt(ToIntFunction<? super T> mapper) |
abstract long |
sumLong(ToLongFunction<? super T> mapper) |
abstract Stream<T> |
tail()
Head and tail should be used by pair.
|
abstract Nullable<T> |
tail2()
Head2 and tail2 should be used by pair.
|
abstract <U> Stream<T> |
takeWhile(U seed,
BiPredicate<? super T,? super U> predicate) |
abstract <A> A[] |
toArray(IntFunction<A[]> generator)
Returns an array containing the elements of this stream, using the
provided
generator function to allocate the returned array, as
well as any additional arrays that might be required for a partitioned
execution or for resizing. |
abstract DataSet |
toDataSet() |
abstract DataSet |
toDataSet(boolean isFirstHeader) |
abstract DataSet |
toDataSet(java.util.List<java.lang.String> columnNames) |
ImmutableList<T> |
toImmutableList() |
<K,U> ImmutableMap<K,U> |
toImmutableMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper) |
<K,U> ImmutableMap<K,U> |
toImmutableMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction) |
ImmutableSet<T> |
toImmutableSet() |
abstract <R> R |
toListAndThen(Function<? super java.util.List<T>,R> func) |
abstract <K,A,D> java.util.Map<K,D> |
toMap(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream) |
abstract <K,A,D,M extends java.util.Map<K,D>> |
toMap(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream,
Supplier<M> mapFactory) |
abstract <K,U> java.util.Map<K,U> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper) |
abstract <K,U> java.util.Map<K,U> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction) |
abstract <K,U,M extends java.util.Map<K,U>> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapFactory) |
abstract <K,U,M extends java.util.Map<K,U>> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper,
Supplier<M> mapFactory) |
abstract Matrix<T> |
toMatrix(java.lang.Class<T> type) |
abstract <K> ListMultimap<K,T> |
toMultimap(Function<? super T,? extends K> keyExtractor) |
abstract <K,U> ListMultimap<K,U> |
toMultimap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper) |
abstract <K,U,V extends java.util.Collection<U>,M extends Multimap<K,U,V>> |
toMultimap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends U> valueMapper,
Supplier<M> mapFactory) |
abstract <K,V extends java.util.Collection<T>,M extends Multimap<K,T,V>> |
toMultimap(Function<? super T,? extends K> keyExtractor,
Supplier<M> mapFactory) |
abstract Stream<T> |
top(int n)
This method only run sequentially, even in parallel stream. |
abstract Stream<T> |
top(int n,
java.util.Comparator<? super T> comparator)
This method only run sequentially, even in parallel stream. |
abstract <R> R |
toSetAndThen(Function<? super java.util.Set<T>,R> func) |
Try<S> |
tried() |
abstract <R> Stream<R> |
triMap(TriFunction<? super T,? super T,? super T,? extends R> mapper) |
abstract <R> Stream<R> |
triMap(TriFunction<? super T,? super T,? super T,? extends R> mapper,
boolean ignoreNotPaired)
Returns a stream consisting of the results of applying the given function
to the every three adjacent elements of this stream.
|
static <T,L,R> Pair<Stream<L>,Stream<R>> |
unzip(java.util.Collection<? extends T> c,
BiConsumer<? super T,Pair<L,R>> unzip) |
static <T,L,R> Pair<Stream<L>,Stream<R>> |
unzip(java.util.Iterator<? extends T> iter,
BiConsumer<? super T,Pair<L,R>> unzip) |
static <T,L,M,R> Triple<Stream<L>,Stream<M>,Stream<R>> |
unzip3(java.util.Collection<? extends T> c,
BiConsumer<? super T,Triple<L,M,R>> unzip) |
static <T,L,M,R> Triple<Stream<L>,Stream<M>,Stream<R>> |
unzip3(java.util.Iterator<? extends T> iter,
BiConsumer<? super T,Triple<L,M,R>> unzip) |
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
static <A,B,R> Stream<R> |
zip(java.util.Collection<? extends A> a,
java.util.Collection<? 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.
|
static <A,B,R> Stream<R> |
zip(java.util.Collection<? extends A> a,
java.util.Collection<? 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.
|
static <A,B,C,R> Stream<R> |
zip(java.util.Collection<? extends A> a,
java.util.Collection<? extends B> b,
java.util.Collection<? 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.
|
static <A,B,C,R> Stream<R> |
zip(java.util.Collection<? extends A> a,
java.util.Collection<? extends B> b,
java.util.Collection<? 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.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends ByteStream> c,
byte[] valuesForNone,
ByteNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends ByteStream> c,
ByteNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends CharStream> c,
char[] valuesForNone,
CharNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends CharStream> c,
CharNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends DoubleStream> c,
double[] valuesForNone,
DoubleNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends DoubleStream> c,
DoubleNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends FloatStream> c,
float[] valuesForNone,
FloatNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends FloatStream> c,
FloatNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends IntStream> c,
int[] valuesForNone,
IntNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends IntStream> c,
IntNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends LongStream> c,
long[] valuesForNone,
LongNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends LongStream> c,
LongNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends ShortStream> c,
short[] valuesForNone,
ShortNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(java.util.Collection<? extends ShortStream> c,
ShortNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <T,R> Stream<R> |
zip(java.util.Collection<? extends Stream<? extends T>> c,
Function<? super java.util.List<? extends T>,R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <T,R> Stream<R> |
zip(java.util.Collection<? extends Stream<? extends T>> c,
java.lang.Object[] valuesForNone,
Function<? super java.util.List<? extends T>,R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
static <A,B,R> Stream<R> |
zip(java.util.Iterator<? extends A> a,
java.util.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.
|
static <A,B,R> Stream<R> |
zip(java.util.Iterator<? extends A> a,
java.util.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.
|
static <A,B,C,R> Stream<R> |
zip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
java.util.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.
|
static <A,B,C,R> Stream<R> |
zip(java.util.Iterator<? extends A> a,
java.util.Iterator<? extends B> b,
java.util.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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
static <T,R> Stream<R> |
zip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
Function<? super java.util.List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
zip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
java.lang.Object[] valuesForNone,
Function<? super java.util.List<? extends T>,R> zipFunction) |
abstract <T2,R> Stream<R> |
zipWith(Stream<T2> b,
BiFunction<? super T,? super T2,R> zipFunction) |
abstract <T2,T3,R> Stream<R> |
zipWith(Stream<T2> b,
Stream<T3> c,
TriFunction<? super T,? super T2,? super T3,R> zipFunction) |
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) |
abstract <T2,R> Stream<R> |
zipWith(Stream<T2> b,
T valueForNoneA,
T2 valueForNoneB,
BiFunction<? super T,? super T2,R> zipFunction) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allMatch, anyMatch, append, cached, count, difference, distinct, dropWhile, filter, findFirst, findFirstOrLast, findLast, first, forEach, indexed, intersection, join, join, last, limit, noneMatch, onClose, parallel, peek, percentiles, prepend, remove, removeIf, removeIf, removeWhile, reversed, reverseSorted, rotated, shuffled, shuffled, skip, sliding, sorted, split, split, split, splitAt, splitBy, splitToList, step, symmetricDifference, takeWhile, toArray, toList, toList, toLongMultiset, toLongMultiset, toMultiset, toMultiset, toSet, toSet
public abstract <U> Stream<T> filter(U seed, BiPredicate<? super T,? super U> predicate)
seed
- initial value to check if the value match the condition.predicate
- public abstract <U> Stream<T> takeWhile(U seed, BiPredicate<? super T,? super U> predicate)
seed
- initial value to check if the value match the condition.predicate
- public abstract <U> Stream<T> dropWhile(U seed, BiPredicate<? super T,? super U> predicate)
seed
- initial value to check if the value match the condition.predicate
- public abstract <U> Stream<T> removeIf(U seed, BiPredicate<? super T,? super U> predicate)
public abstract <U> Stream<T> removeIf(U seed, BiPredicate<? super T,? super U> predicate, Consumer<? super T> consumer)
public abstract <U> Stream<T> removeWhile(U seed, BiPredicate<? super T,? super U> predicate, Consumer<? super T> consumer)
predicate
return false.
If there is no more elements then an empty stream will be returned.seed
- predicate
- consumer
- dropWhile(Object, BiPredicate)
public abstract <R> Stream<R> map(Function<? super T,? extends R> mapper)
This is an intermediate operation.
R
- The element type of the new streammapper
- a non-interfering,
stateless
function to apply to each elementpublic <U> Stream<U> select(java.lang.Class<U> targetType)
targetType
- public abstract <U,R> Stream<R> map(U seed, BiFunction<? super T,? super U,? extends R> mapper)
public abstract <R> Stream<R> biMap(BiFunction<? super T,? super T,? extends R> mapper)
public abstract <R> Stream<R> biMap(BiFunction<? super T,? super T,? extends R> mapper, boolean ignoreNotPaired)
Stream.of("a", "b", "c", "d", "e").biMap((i, j) -> i + "-" + j).println();
// print out: [a-b, c-d, e-null]
mapper
- ignoreNotPaired
- flag to identify if need to ignore the last element when the total length of the stream is odd number. Default value is falsepublic abstract <R> Stream<R> triMap(TriFunction<? super T,? super T,? super T,? extends R> mapper)
public abstract <R> Stream<R> triMap(TriFunction<? super T,? super T,? super T,? extends R> mapper, boolean ignoreNotPaired)
Stream.of("a", "b", "c", "d", "e").triMap((i, j, k) -> i + "-" + j + "-" + k).println();
// print out: [a-b-c, d-e-null]
mapper
- ignoreNotPaired
- flag to identify if need to ignore the last one or two elements when the total length of the stream is not multiple of 3. Default value is falsepublic abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper)
public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper, int increment)
windowSize = 2
and the specified increment
, then map
by the specified mapper
.mapper
- increment
- public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper)
public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper, int increment)
windowSize = 3
and the specified increment
, then map
by the specified mapper
.mapper
- increment
- public abstract <U> Stream<U> rangeMap(BiPredicate<? super T,? super T> sameRange, BiFunction<? super T,? super T,? extends U> mapper)
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.
U
- the type of the resulting elementssameRange
- 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.#collapse(BiPredicate, BinaryOperator)
public abstract <R> Stream<R> mapFirstOrElse(Function<? super T,? extends R> mapperForFirst, Function<? super T,? extends R> mapperForElse)
public abstract <R> Stream<R> mapLastOrElse(Function<? super T,? extends R> mapperForLast, Function<? super T,? extends R> mapperForElse)
public abstract CharStream mapToChar(ToCharFunction<? super T> mapper)
public abstract ByteStream mapToByte(ToByteFunction<? super T> mapper)
public abstract ShortStream mapToShort(ToShortFunction<? super T> mapper)
public abstract IntStream mapToInt(ToIntFunction<? super T> mapper)
IntStream
consisting of the results of applying the
given function to the elements of this stream.
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementpublic abstract LongStream mapToLong(ToLongFunction<? super T> mapper)
LongStream
consisting of the results of applying the
given function to the elements of this stream.
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementpublic abstract FloatStream mapToFloat(ToFloatFunction<? super T> mapper)
public abstract DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper)
DoubleStream
consisting of the results of applying the
given function to the elements of this stream.
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementpublic abstract <K,V> EntryStream<K,V> mapToEntry(Function<? super T,? extends java.util.Map.Entry<K,V>> mapper)
public abstract <K,V> EntryStream<K,V> mapToEntry(Function<? super T,K> keyMapper, Function<? super T,V> valueMapper)
public abstract <R> Stream<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
This is an intermediate operation.
R
- The element type of the new streammapper
- a non-interfering,
stateless
function to apply to each element which produces a stream
of new valuespublic abstract <U,R> Stream<R> flatMap(U seed, BiFunction<? super T,? super U,? extends Stream<? extends R>> mapper)
public abstract <R> Stream<R> flatCollection(Function<? super T,? extends java.util.Collection<? extends R>> mapper)
public abstract <U,R> Stream<R> flatCollection(U seed, BiFunction<? super T,? super U,? extends java.util.Collection<? extends R>> mapper)
public abstract <U,R> Stream<R> flatArray(U seed, BiFunction<? super T,? super U,R[]> mapper)
public abstract CharStream flatMapToChar(Function<? super T,? extends CharStream> mapper)
public abstract ByteStream flatMapToByte(Function<? super T,? extends ByteStream> mapper)
public abstract ShortStream flatMapToShort(Function<? super T,? extends ShortStream> mapper)
public abstract IntStream flatMapToInt(Function<? super T,? extends IntStream> mapper)
IntStream
consisting of the results of replacing each
element of this stream with the contents of a mapped stream produced by
applying the provided mapping function to each element. Each mapped
stream is closed
after its
contents have been placed into this stream. (If a mapped stream is
null
an empty stream is used, instead.)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each element which produces a stream
of new valuesflatMap(Function)
public abstract LongStream flatMapToLong(Function<? super T,? extends LongStream> mapper)
LongStream
consisting of the results of replacing each
element of this stream with the contents of a mapped stream produced by
applying the provided mapping function to each element. Each mapped
stream is closed
after its
contents have been placed into this stream. (If a mapped stream is
null
an empty stream is used, instead.)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each element which produces a stream
of new valuesflatMap(Function)
public abstract FloatStream flatMapToFloat(Function<? super T,? extends FloatStream> mapper)
public abstract DoubleStream flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
DoubleStream
consisting of the results of replacing
each element of this stream with the contents of a mapped stream produced
by applying the provided mapping function to each element. Each mapped
stream is closed
after its
contents have placed been into this stream. (If a mapped stream is
null
an empty stream is used, instead.)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each element which produces a stream
of new valuesflatMap(Function)
public abstract <K,V> EntryStream<K,V> flatMapToEntry(Function<? super T,? extends Stream<? extends java.util.Map.Entry<K,V>>> mapper)
public abstract <K> Stream<java.util.Map.Entry<K,java.util.List<T>>> groupBy(Function<? super T,? extends K> classifier)
public abstract <K> Stream<java.util.Map.Entry<K,java.util.List<T>>> groupBy(Function<? super T,? extends K> classifier, Supplier<java.util.Map<K,java.util.List<T>>> mapFactory)
public abstract <K,U> Stream<java.util.Map.Entry<K,java.util.List<U>>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper)
classifier
- valueMapper
- Collectors.toMultimap(Function, Function)
public abstract <K,U> Stream<java.util.Map.Entry<K,java.util.List<U>>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Supplier<java.util.Map<K,java.util.List<U>>> mapFactory)
classifier
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
public abstract <K,A,D> Stream<java.util.Map.Entry<K,D>> groupBy(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream)
public abstract <K,A,D> Stream<java.util.Map.Entry<K,D>> groupBy(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream, Supplier<java.util.Map<K,D>> mapFactory)
public abstract <K,U> Stream<java.util.Map.Entry<K,U>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)
public abstract <K,U> Stream<java.util.Map.Entry<K,U>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<java.util.Map<K,U>> mapFactory)
public abstract <K> EntryStream<K,java.util.List<T>> groupByToEntry(Function<? super T,? extends K> classifier)
public abstract <K> EntryStream<K,java.util.List<T>> groupByToEntry(Function<? super T,? extends K> classifier, Supplier<java.util.Map<K,java.util.List<T>>> mapFactory)
public abstract <K,U> EntryStream<K,java.util.List<U>> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper)
classifier
- valueMapper
- Collectors.toMultimap(Function, Function)
public abstract <K,U> EntryStream<K,java.util.List<U>> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Supplier<java.util.Map<K,java.util.List<U>>> mapFactory)
classifier
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
public abstract <K,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream)
public abstract <K,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream, Supplier<java.util.Map<K,D>> mapFactory)
public abstract <K,U> EntryStream<K,U> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)
public abstract <K,U> EntryStream<K,U> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<java.util.Map<K,U>> mapFactory)
public abstract Stream<java.util.List<T>> splitToList(int size)
size
- public abstract Stream<java.util.Set<T>> splitToSet(int size)
size
- public abstract <U> Stream<java.util.List<T>> splitToList(U seed, BiPredicate<? super T,? super U> predicate, Consumer<? super U> seedUpdate)
// split the number sequence by window 5.
Stream.of(1, 2, 3, 5, 7, 9, 10, 11, 19).splitToList(MutableInt.of(5), (e, b) -> e <= b.intValue(), b -> b.addAndGet(5)).forEach(N::println);
This stream should be sorted by value which is used to verify the border.
seed
- predicate
- seedUpdate
- public abstract <U> Stream<java.util.Set<T>> splitToSet(U seed, BiPredicate<? super T,? super U> predicate, Consumer<? super U> seedUpdate)
// split the number sequence by window 5.
Stream.of(1, 2, 3, 5, 7, 9, 10, 11, 19).splitToSet(MutableInt.of(5), (e, b) -> e <= b.intValue(), b -> b.addAndGet(5)).forEach(N::println);
This stream should be sorted by value which is used to verify the border.
seed
- predicate
- seedUpdate
- public abstract Stream<java.util.List<T>> slidingToList(int windowSize)
slidingToList
in interface BaseStream<T,java.lang.Object[],Predicate<? super T>,Consumer<? super T>,java.util.List<T>,Nullable<T>,com.landawn.abacus.util.Indexed<T>,Stream<T>>
BaseStream.sliding(int, int)
public abstract Stream<java.util.List<T>> slidingToList(int windowSize, int increment)
BaseStream.sliding(int, int)
public abstract Stream<T> collapse(BiPredicate<? super T,? super T> collapsible, BiFunction<? super T,? super T,T> mergeFunction)
collapsible
- mergeFunction
- public abstract <R,A> Stream<R> collapse(BiPredicate<? super T,? super T> collapsible, Collector<? super T,A,R> collector)
collapsible
- collector
- public abstract Stream<T> scan(BiFunction<? super T,? super T,T> accumulator)
Stream
produced by iterative application of a accumulation function
to an initial element seed
and next element of the current stream.
Produces a Stream
consisting of seed
, acc(seed, value1)
,
acc(acc(seed, value1), value2)
, etc.
This is an intermediate operation.
Example:
accumulator: (a, b) -> a + b stream: [1, 2, 3, 4, 5] result: [1, 3, 6, 10, 15]
accumulator
- the accumulation functionpublic abstract <R> Stream<R> scan(R seed, BiFunction<? super R,? super T,R> accumulator)
Stream
produced by iterative application of a accumulation function
to an initial element seed
and next element of the current stream.
Produces a Stream
consisting of seed
, acc(seed, value1)
,
acc(acc(seed, value1), value2)
, etc.
This is an intermediate operation.
Example:
seed:10 accumulator: (a, b) -> a + b stream: [1, 2, 3, 4, 5] result: [11, 13, 16, 20, 25]
seed
- 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 functionpublic abstract Stream<T> intersperse(T delimiter)
Stream.of(1).intersperse(9) --> [1]
Stream.of(1, 2, 3).intersperse(9) --> [1, 9, 2, 9, 3]
delimiter
- public abstract Stream<T> distinctBy(Function<? super T,?> keyExtractor)
keyExtractor
keyExtractor
- don't change value of the input parameter.public abstract Stream<T> top(int n)
n
- public abstract Stream<T> top(int n, java.util.Comparator<? super T> comparator)
n
- comparator
- public abstract Stream<T> sorted(java.util.Comparator<? super T> comparator)
Comparator
.
For ordered streams, the sort is stable. For unordered streams, no stability guarantees are made.
This is a stateful intermediate operation.
comparator
- a non-interfering,
stateless
Comparator
to be used to compare stream elementspublic abstract Stream<T> sortedBy(Function<? super T,? extends java.lang.Comparable> keyExtractor)
public abstract <R> R forEach(R seed, BiFunction<R,? super T,R> accumulator, BiPredicate<? super R,? super T> conditionToBreak)
accumulator
on each element till true
is returned by conditionToBreak
seed
- accumulator
- conditionToBreak
- break if true
is return.public abstract void forEachPair(BiConsumer<? super T,? super T> action)
public abstract void forEachPair(BiConsumer<? super T,? super T> action, int increment)
windowSize = 2
and the specified increment
, then consume
by the specified mapper
.mapper
- increment
- public abstract void forEachTriple(TriConsumer<? super T,? super T,? super T> action)
public abstract void forEachTriple(TriConsumer<? super T,? super T,? super T> action, int increment)
windowSize = 3
and the specified increment
, then consume
by the specified mapper
.mapper
- increment
- public abstract <U> Nullable<T> findFirst(U seed, BiPredicate<? super T,? super U> predicate)
seed
- predicate
- public abstract <U> Nullable<T> findLast(U seed, BiPredicate<? super T,? super U> predicate)
seed
- predicate
- public abstract <U> Nullable<T> findAny(U seed, BiPredicate<? super T,? super U> predicate)
seed
- predicate
- public abstract <U> Nullable<T> findFirstOrLast(U seed, BiPredicate<? super T,? super U> predicateForFirst, BiPredicate<? super T,? super U> predicateForLast)
seed
- predicateForFirst
- predicateForLast
- public abstract <U> Nullable<T> findFirstOrLast(Function<? super T,U> preFunc, BiPredicate<? super T,? super U> predicateForFirst, BiPredicate<? super T,? super U> predicateForLast)
preFunc
- predicateForFirst
- predicateForLast
- public abstract <U> boolean anyMatch(U seed, BiPredicate<? super T,? super U> predicate)
public abstract <U> boolean allMatch(U seed, BiPredicate<? super T,? super U> predicate)
public abstract <U> boolean noneMatch(U seed, BiPredicate<? super T,? super U> predicate)
public abstract boolean containsAll(T... a)
public abstract boolean containsAll(java.util.Collection<? extends T> c)
public abstract <A> A[] toArray(IntFunction<A[]> generator)
generator
function to allocate the returned array, as
well as any additional arrays that might be required for a partitioned
execution or for resizing.
This is a terminal operation.
A
- the element type of the resulting arraygenerator
- a function which produces a new array of the desired
type and the provided lengthjava.lang.ArrayStoreException
- if the runtime type of the array returned
from the array generator is not a supertype of the runtime type of every
element in this streampublic ImmutableList<T> toImmutableList()
public ImmutableSet<T> toImmutableSet()
public <K,U> ImmutableMap<K,U> toImmutableMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper)
keyExtractor
- valueMapper
- Collectors.toMap(Function, Function)
public <K,U> ImmutableMap<K,U> toImmutableMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)
keyExtractor
- valueMapper
- mergeFunction
- Collectors.toMap(Function, Function)
public abstract <K,U> java.util.Map<K,U> toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper)
keyExtractor
- valueMapper
- Collectors.toMap(Function, Function)
public abstract <K,U> java.util.Map<K,U> toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)
keyExtractor
- valueMapper
- mergeFunction
- Collectors.toMap(Function, Function, BinaryOperator)
public abstract <K,U,M extends java.util.Map<K,U>> M toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mapFactory
- Collectors.toMap(Function, Function, Supplier)
public abstract <K,U,M extends java.util.Map<K,U>> M toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mergeFunction
- mapFactory
- Collectors.toMap(Function, Function, BinaryOperator, Supplier)
public abstract <K,A,D> java.util.Map<K,D> toMap(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream)
classifier
- downstream
- Collectors.groupingBy(Function, Collector)
public abstract <K,A,D,M extends java.util.Map<K,D>> M toMap(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream, Supplier<M> mapFactory)
classifier
- downstream
- mapFactory
- Collectors.groupingBy(Function, Collector, Supplier)
public abstract <K> java.util.Map<K,java.util.List<T>> groupTo(Function<? super T,? extends K> classifier)
classifier
- Collectors.groupingBy(Function)
public abstract <K,M extends java.util.Map<K,java.util.List<T>>> M groupTo(Function<? super T,? extends K> classifier, Supplier<M> mapFactory)
classifier
- mapFactory
- Collectors.groupingBy(Function, Supplier)
public abstract <K,U> java.util.Map<K,java.util.List<U>> groupTo(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper)
public abstract <K,U,M extends java.util.Map<K,java.util.List<U>>> M groupTo(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
public abstract <K> ListMultimap<K,T> toMultimap(Function<? super T,? extends K> keyExtractor)
keyExtractor
- Collectors.toMultimap(Function, Function)
public abstract <K,V extends java.util.Collection<T>,M extends Multimap<K,T,V>> M toMultimap(Function<? super T,? extends K> keyExtractor, Supplier<M> mapFactory)
keyExtractor
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
public abstract <K,U> ListMultimap<K,U> toMultimap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper)
keyExtractor
- valueMapper
- Collectors.toMultimap(Function, Function)
public abstract <K,U,V extends java.util.Collection<U>,M extends Multimap<K,U,V>> M toMultimap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends U> valueMapper, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
public abstract DataSet toDataSet()
public abstract DataSet toDataSet(boolean isFirstHeader)
isFirstHeader
- public abstract DataSet toDataSet(java.util.List<java.lang.String> columnNames)
columnNames
- it can be null or empty if this is Map or entity stream.public abstract T reduce(T identity, BinaryOperator<T> accumulator)
T result = identity;
for (T element : this stream)
result = accumulator.apply(result, element)
return result;
but is not constrained to execute sequentially.
The identity
value must be an identity for the accumulator
function. This means that for all t
,
accumulator.apply(identity, t)
is equal to t
.
The accumulator
function must be an
associative function.
This is a terminal operation.
identity
- the identity value for the accumulating functionaccumulator
- an associative,
non-interfering,
stateless
function for combining two valuespublic abstract Nullable<T> reduce(BinaryOperator<T> accumulator)
Optional
describing the reduced value,
if any. This is equivalent to:
boolean foundAny = false;
T result = null;
for (T element : this stream) {
if (!foundAny) {
foundAny = true;
result = element;
}
else
result = accumulator.apply(result, element);
}
return foundAny ? Nullable.of(result) : Nullable.empty();
but is not constrained to execute sequentially.
The accumulator
function must be an
associative function.
This is a terminal operation.
accumulator
- an associative,
non-interfering,
stateless
function for combining two valuesOptional
describing the result of the reductionreduce(Object, BinaryOperator)
,
min(Comparator)
,
max(Comparator)
public abstract <U> U reduce(U identity, BiFunction<U,? super T,U> accumulator, BinaryOperator<U> combiner)
U result = identity;
for (T element : this stream)
result = accumulator.apply(result, element)
return result;
but is not constrained to execute sequentially.
The identity
value must be an identity for the zipFunction
function. This means that for all u
, zipFunction(identity, u)
is equal to u
. Additionally, the zipFunction
function
must be compatible with the accumulator
function; for all
u
and t
, the following must hold:
zipFunction.apply(u, accumulator.apply(identity, t)) == accumulator.apply(u, t)
This is a terminal operation.
U
- The type of the resultidentity
- the identity value for the zipFunction functionaccumulator
- an associative,
non-interfering,
stateless
function for incorporating an additional element into a resultcombiner
- an associative,
non-interfering,
stateless
function for combining two values, which must be
compatible with the accumulator functionreduce(BinaryOperator)
,
reduce(Object, BinaryOperator)
public abstract <U> U reduce(U identity, BiFunction<U,? super T,U> accumulator)
a.addAll(b)
if result container is Collection/Multiset/LongMultiset/IntList/CharList/...
,
or a.putAll(b)
if result container is Map/Multimap/Sheet
,
or a.append(b)
if result container is StringBuilder
,
or N.concat(a, b)
if result container is array: boolean[]/char[]/int[]/.../Object[]
when it's necessary in Parallel Stream.identity
- accumulator
- java.lang.RuntimeException
- if the result container can't be merged by default when it's necessary in Parallel Stream.public abstract <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner)
ArrayList
, and elements are incorporated by updating
the state of the result rather than by replacing the result. This
produces a result equivalent to:
R result = supplier.get();
for (T element : this stream)
accumulator.accept(result, element);
return result;
Like reduce(Object, BinaryOperator)
, collect
operations
can be parallelized without requiring additional synchronization.
This is a terminal operation.
R
- type of the resultsupplier
- a function that creates a new result container. For a
parallel execution, this function may be called
multiple times and must return a fresh value each time.accumulator
- an associative,
non-interfering,
stateless
function for incorporating an additional element into a resultcombiner
- an associative,
non-interfering,
stateless
function for combining two values, which must be
compatible with the accumulator functionpublic abstract <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator)
a.addAll(b)
if result container is Collection/Multiset/LongMultiset/IntList/CharList/...
,
or a.putAll(b)
if result container is Map/Multimap/Sheet
,
or a.append(b)
if result container is StringBuilder
when it's necessary in Parallel Stream.supplier
- accumulator
- java.lang.RuntimeException
- if the result container can't be merged by default when it's necessary in Parallel Stream.public abstract <R,A> R collect(Collector<? super T,A,R> collector)
Collector
. A Collector
encapsulates the functions used as arguments to
collect(Supplier, BiConsumer, BiConsumer)
, allowing for reuse of
collection strategies and composition of collect operations such as
multiple-level grouping or partitioning.
If the stream is parallel, and the Collector
is concurrent
, and
either the stream is unordered or the collector is
unordered
,
then a concurrent reduction will be performed (see Collector
for
details on concurrent reduction.)
This is a terminal operation.
When executed in parallel, multiple intermediate results may be
instantiated, populated, and merged so as to maintain isolation of
mutable data structures. Therefore, even when executed in parallel
with non-thread-safe data structures (such as ArrayList
), no
additional synchronization is needed for a parallel reduction.
R
- the type of the resultA
- the intermediate accumulation type of the Collector
collector
- the Collector
describing the reductioncollect(Supplier, BiConsumer, BiConsumer)
,
Collectors
public abstract <R,A> R collect(java.util.stream.Collector<? super T,A,R> collector)
public abstract <R,A,RR> RR collectAndThen(Collector<? super T,A,R> downstream, Function<R,RR> finisher)
public abstract <R,A,RR> RR collectAndThen(java.util.stream.Collector<? super T,A,R> downstream, Function<R,RR> finisher)
public abstract Nullable<T> head()
public abstract Stream<T> tail()
public abstract Stream<T> head2()
public abstract Nullable<T> tail2()
public abstract Pair<Stream<T>,Nullable<T>> headAndTail2()
public abstract Stream<T> last(int n)
n
will be maintained to filter out the last n
elements.
It may cause out of memory error
if n
is big enough.n
- public abstract Stream<T> skipLast(int n)
n
will be maintained to filter out the last n
elements.
It may cause out of memory error
if n
is big enough.n
- public abstract Nullable<T> min(java.util.Comparator<? super T> comparator)
Comparator
. This is a special case of a
reduction.
This is a terminal operation.
comparator
- a non-interfering,
stateless
Comparator
to compare elements of this streamOptional
describing the minimum element of this stream,
or an empty Optional
if the stream is emptypublic abstract Nullable<T> max(java.util.Comparator<? super T> comparator)
Comparator
. This is a special case of a
reduction.
This is a terminal operation.
comparator
- a non-interfering,
stateless
Comparator
to compare elements of this streamOptional
describing the maximum element of this stream,
or an empty Optional
if the stream is emptypublic abstract Nullable<T> kthLargest(int k, java.util.Comparator<? super T> comparator)
k
- comparator
- public abstract int sumInt(ToIntFunction<? super T> mapper)
public abstract long sumLong(ToLongFunction<? super T> mapper)
public abstract double sumDouble(ToDoubleFunction<? super T> mapper)
public abstract OptionalDouble averageInt(ToIntFunction<? super T> mapper)
public abstract OptionalDouble averageLong(ToLongFunction<? super T> mapper)
public abstract OptionalDouble averageDouble(ToDoubleFunction<? super T> mapper)
public abstract Optional<java.util.Map<com.landawn.abacus.util.Percentage,T>> percentiles(java.util.Comparator<? super T> comparator)
public abstract Stream<java.util.List<T>> orderedPermutations(java.util.Comparator<? super T> comparator)
@SafeVarargs public final Stream<java.util.List<T>> cartesianProduct(java.util.Collection<? extends T>... cs)
public abstract Stream<java.util.List<T>> cartesianProduct(java.util.Collection<? extends java.util.Collection<? extends T>> cs)
public abstract <U> Stream<Pair<T,U>> innerJoin(java.util.Collection<U> b, Function<? super T,?> leftKeyMapper, Function<? super U,?> rightKeyMapper)
Stream
and m is the size of specified collection b
.b
- leftKeyMapper
- rightKeyMapper
- public abstract <U> Stream<Pair<T,U>> innerJoin(java.util.Collection<U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.b
- predicate
- public abstract <U> Stream<Pair<T,U>> fullJoin(java.util.Collection<U> b, Function<? super T,?> leftKeyMapper, Function<? super U,?> rightKeyMapper)
Stream
and m is the size of specified collection b
.b
- leftKeyMapper
- rightKeyMapper
- public abstract <U> Stream<Pair<T,U>> fullJoin(java.util.Collection<U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.b
- predicate
- public abstract <U> Stream<Pair<T,U>> leftJoin(java.util.Collection<U> b, Function<? super T,?> leftKeyMapper, Function<? super U,?> rightKeyMapper)
Stream
and m is the size of specified collection b
.b
- leftKeyMapper
- rightKeyMapper
- public abstract <U> Stream<Pair<T,U>> leftJoin(java.util.Collection<U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.b
- predicate
- public abstract <U> Stream<Pair<T,U>> rightJoin(java.util.Collection<U> b, Function<? super T,?> leftKeyMapper, Function<? super U,?> rightKeyMapper)
Stream
and m is the size of specified collection b
.b
- leftKeyMapper
- rightKeyMapper
- public abstract <U> Stream<Pair<T,U>> rightJoin(java.util.Collection<U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.b
- predicate
- public abstract boolean hasDuplicates()
public abstract Stream<T> intersection(Function<? super T,?> mapper, java.util.Collection<?> c)
mapper
.mapper
- c
- IntList.intersection(IntList)
public abstract Stream<T> difference(Function<? super T,?> mapper, java.util.Collection<?> c)
mapper
.mapper
- c
- IntList.difference(IntList)
public abstract Stream<T> cached(IntFunction<T[]> generator)
generator
- public abstract Stream<T> queued(int queueSize)
queueSize
- Default value is 8public abstract Stream<T> merge(Stream<? extends T> b, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public abstract <T2,R> Stream<R> zipWith(Stream<T2> b, BiFunction<? super T,? super T2,R> zipFunction)
public abstract <T2,T3,R> Stream<R> zipWith(Stream<T2> b, Stream<T3> c, TriFunction<? super T,? super T2,? super T3,R> zipFunction)
public abstract <T2,R> Stream<R> zipWith(Stream<T2> b, T valueForNoneA, T2 valueForNoneB, BiFunction<? super T,? super T2,R> zipFunction)
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)
public abstract long persist(java.io.File file, Function<? super T,java.lang.String> toLine)
public abstract long persist(java.io.OutputStream os, Function<? super T,java.lang.String> toLine)
public abstract long persist(java.io.Writer writer, Function<? super T,java.lang.String> toLine)
public abstract long persist(java.sql.Connection conn, java.lang.String insertSQL, int batchSize, int batchInterval, Try.BiConsumer<? super java.sql.PreparedStatement,? super T,java.sql.SQLException> stmtSetter)
public abstract long persist(java.sql.PreparedStatement stmt, int batchSize, int batchInterval, Try.BiConsumer<? super java.sql.PreparedStatement,? super T,java.sql.SQLException> stmtSetter)
public ObjIterator<T> iterator()
BaseStream
@Beta public abstract <K,V> EntryStream<K,V> mapToEntryER(Function<? super T,K> keyMapper, Function<? super T,V> valueMapper)
Map.Entry
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.
ER
= Entry Reusable
keyMapper
- valueMapper
- public static <T> Stream<T> empty()
public static <T> Stream<T> just(T a)
@SafeVarargs public static <T> Stream<T> of(T... a)
public static <T> Stream<T> of(T[] a, int startIndex, int endIndex)
Stream
.a
- startIndex
- endIndex
- public static <T> Stream<T> of(java.util.Collection<? extends T> c)
Stream
.c
- public static <T> Stream<T> of(java.util.Collection<? extends T> c, int startIndex, int endIndex)
Stream
.c
- startIndex
- endIndex
- public static <K,V> Stream<java.util.Map.Entry<K,V>> of(java.util.Map<K,V> map)
public static <T> Stream<T> of(java.util.Iterator<? extends T> iterator)
Stream
.iterator
- public static <T> Stream<T> of(java.util.stream.Stream<T> stream)
public static Stream<java.lang.String> of(java.io.Reader reader)
reader
after the stream is finished.reader
- public static Stream<java.lang.Object[]> of(java.sql.ResultSet resultSet)
resultSet
after the stream is finished.resultSet
- public static <T> Stream<T> of(java.lang.Class<T> targetClass, java.sql.ResultSet resultSet)
public static Try<Stream<java.lang.String>> of(java.io.File file, java.nio.charset.Charset charset)
public static Try<Stream<java.lang.String>> of(java.nio.file.Path path, java.nio.charset.Charset charset)
public static <T> Stream<T> ofNullable(T t)
public static Stream<java.lang.Boolean> of(boolean[] a)
public static Stream<java.lang.Boolean> of(boolean[] a, int fromIndex, int toIndex)
public static Stream<java.lang.Character> of(char[] a)
public static Stream<java.lang.Character> of(char[] a, int fromIndex, int toIndex)
public static Stream<java.lang.Byte> of(byte[] a)
public static Stream<java.lang.Byte> of(byte[] a, int fromIndex, int toIndex)
public static Stream<java.lang.Short> of(short[] a)
public static Stream<java.lang.Short> of(short[] a, int fromIndex, int toIndex)
public static Stream<java.lang.Integer> of(int[] a)
public static Stream<java.lang.Integer> of(int[] a, int fromIndex, int toIndex)
public static Stream<java.lang.Long> of(long[] a)
public static Stream<java.lang.Long> of(long[] a, int fromIndex, int toIndex)
public static Stream<java.lang.Float> of(float[] a)
public static Stream<java.lang.Float> of(float[] a, int fromIndex, int toIndex)
public static Stream<java.lang.Double> of(double[] a)
public static Stream<java.lang.Double> of(double[] a, int fromIndex, int toIndex)
public static <T> Stream<T> of(Supplier<java.util.Collection<? extends T>> supplier)
supplier
- public static <T> Stream<T> repeat(T element, long n)
public static <T> Stream<T> iterate(Supplier<java.lang.Boolean> hasNext, Supplier<? extends T> next)
public static <T> Stream<T> iterate(T seed, Supplier<java.lang.Boolean> hasNext, UnaryOperator<T> f)
Stream
produced by iterative
application of a function f
to an initial element seed
,
producing a Stream
consisting of seed
, f(seed)
,
f(f(seed))
, etc.
The first element (position 0
) in the Stream
will be
the provided seed
. For n > 0
, the element at position
n
, will be the result of applying the function f
to the
element at position n - 1
.
seed
- hasNext
- f
- public static <T> Stream<T> iterate(T seed, Predicate<T> hasNext, UnaryOperator<T> f)
seed
- hasNext
- test if has next by hasNext.test(seed) for first time and hasNext.test(f.apply(previous)) for remaining.f
- public static <T> Stream<T> iterate(T seed, UnaryOperator<T> f)
public static <T> Stream<T> interval(long intervalInMillis, Supplier<T> s)
intervalInMillis
- s
- public static <T> Stream<T> interval(long delayInMillis, long intervalInMillis, Supplier<T> s)
delayInMillis
- intervalInMillis
- s
- TimeUnit
public static <T> Stream<T> interval(long delay, long interval, java.util.concurrent.TimeUnit unit, Supplier<T> s)
delay
- interval
- unit
- s
- public static <T> Stream<T> interval(long intervalInMillis, LongFunction<T> s)
public static <T> Stream<T> interval(long delayInMillis, long intervalInMillis, LongFunction<T> s)
delayInMillis
- intervalInMillis
- s
- TimeUnit
public static <T> Stream<T> interval(long delay, long interval, java.util.concurrent.TimeUnit unit, LongFunction<T> s)
delay
- interval
- unit
- s
- public static Stream<java.lang.String> split(java.lang.String str, java.lang.String delimiter)
str
- delimiter
- public static Stream<java.lang.String> split(java.lang.String str, java.lang.String delimiter, boolean trim)
str
- delimiter
- trim
- public static Stream<java.lang.String> split(java.lang.String str, char delimiter)
str
- delimiter
- public static Stream<java.lang.String> split(java.lang.String str, char delimiter, boolean trim)
str
- delimiter
- trim
- public static Stream<java.io.File> list(java.io.File parentPath)
public static Stream<java.io.File> list(java.io.File parentPath, boolean recursively)
public static <T> Stream<T> observe(java.util.concurrent.BlockingQueue<T> queue, Duration duration)
public static <T> Stream<T> observe(java.util.concurrent.BlockingQueue<T> queue, Predicate<? super T> isLast, long maxWaitIntervalInMillis)
@SafeVarargs public static <T> Stream<T> concat(T[]... a)
@SafeVarargs public static <T> Stream<T> concat(java.util.Collection<? extends T>... a)
@SafeVarargs public static <T> Stream<T> concat(java.util.Iterator<? extends T>... a)
public static <T> Stream<T> concat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c)
@SafeVarargs public static <T> Stream<T> parallelConcat(java.util.Iterator<? extends T>... a)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
a
- public static <T> Stream<T> parallelConcat(java.util.Iterator<? extends T>[] a, int readThreadNum, int queueSize)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
a
- readThreadNum
- - count of threads used to read elements from iterator to queue. Default value is min(8, a.length)queueSize
- Default value is N.min(128, a.length * 16)@SafeVarargs public static <T> Stream<T> parallelConcat(Stream<? extends T>... a)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
a
- public static <T> Stream<T> parallelConcat(Stream<? extends T>[] a, int readThreadNum, int queueSize)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
a
- readThreadNum
- - count of threads used to read elements from iterator to queue. Default value is min(8, a.length)queueSize
- Default value is N.min(128, a.length * 16)public static <T> Stream<T> parallelConcat(java.util.Collection<? extends Stream<? extends T>> c)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
c
- public static <T> Stream<T> parallelConcat(java.util.Collection<? extends Stream<? extends T>> c, int readThreadNum)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
c
- readThreadNum
- public static <T> Stream<T> parallelConcat(java.util.Collection<? extends Stream<? extends T>> c, int readThreadNum, int queueSize)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
a
- readThreadNum
- - count of threads used to read elements from iterator to queue. Default value is min(8, c.size())queueSize
- Default value is N.min(128, c.size() * 16)public static <T> Stream<T> parallelConcat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
c
- public static <T> Stream<T> parallelConcat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, int readThreadNum)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
c
- readThreadNum
- public static <T> Stream<T> parallelConcat2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, int readThreadNum, int queueSize)
try (Stream stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
a
- readThreadNum
- - count of threads used to read elements from iterator to queue. Default value is min(8, c.size())queueSize
- Default value is N.min(128, c.size() * 16)public static <R> Stream<R> zip(char[] a, char[] b, CharBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(char[] a, char[] b, char[] c, CharTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharIterator c, CharTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(CharStream a, CharStream b, CharBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(CharStream a, CharStream b, CharStream c, CharTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(java.util.Collection<? extends CharStream> c, CharNFunction<R> zipFunction)
c
- zipFunction
- public static <R> Stream<R> zip(char[] a, char[] b, char valueForNoneA, char valueForNoneB, CharBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(char[] a, char[] b, char[] c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(CharIterator a, CharIterator b, char valueForNoneA, char valueForNoneB, CharBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(CharIterator a, CharIterator b, CharIterator c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(CharStream a, CharStream b, char valueForNoneA, char valueForNoneB, CharBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(CharStream a, CharStream b, CharStream c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(java.util.Collection<? extends CharStream> c, char[] valuesForNone, CharNFunction<R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <R> Stream<R> zip(byte[] a, byte[] b, ByteBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(byte[] a, byte[] b, byte[] c, ByteTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteIterator c, ByteTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteStream c, ByteTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(java.util.Collection<? extends ByteStream> c, ByteNFunction<R> zipFunction)
c
- zipFunction
- public static <R> Stream<R> zip(byte[] a, byte[] b, byte valueForNoneA, byte valueForNoneB, ByteBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(byte[] a, byte[] b, byte[] c, byte valueForNoneA, byte valueForNoneB, byte valueForNoneC, ByteTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, byte valueForNoneA, byte valueForNoneB, ByteBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ByteIterator a, ByteIterator b, ByteIterator c, byte valueForNoneA, byte valueForNoneB, byte valueForNoneC, ByteTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ByteStream a, ByteStream b, byte valueForNoneA, byte valueForNoneB, ByteBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ByteStream a, ByteStream b, ByteStream c, byte valueForNoneA, byte valueForNoneB, byte valueForNoneC, ByteTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(java.util.Collection<? extends ByteStream> c, byte[] valuesForNone, ByteNFunction<R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <R> Stream<R> zip(short[] a, short[] b, ShortBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(short[] a, short[] b, short[] c, ShortTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortIterator c, ShortTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortStream c, ShortTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(java.util.Collection<? extends ShortStream> c, ShortNFunction<R> zipFunction)
c
- zipFunction
- public static <R> Stream<R> zip(short[] a, short[] b, short valueForNoneA, short valueForNoneB, ShortBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(short[] a, short[] b, short[] c, short valueForNoneA, short valueForNoneB, short valueForNoneC, ShortTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, short valueForNoneA, short valueForNoneB, ShortBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ShortIterator a, ShortIterator b, ShortIterator c, short valueForNoneA, short valueForNoneB, short valueForNoneC, ShortTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ShortStream a, ShortStream b, short valueForNoneA, short valueForNoneB, ShortBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(ShortStream a, ShortStream b, ShortStream c, short valueForNoneA, short valueForNoneB, short valueForNoneC, ShortTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(java.util.Collection<? extends ShortStream> c, short[] valuesForNone, ShortNFunction<R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <R> Stream<R> zip(int[] a, int[] b, IntBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(int[] a, int[] b, int[] c, IntTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntIterator c, IntTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(IntStream a, IntStream b, IntBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(IntStream a, IntStream b, IntStream c, IntTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(java.util.Collection<? extends IntStream> c, IntNFunction<R> zipFunction)
c
- zipFunction
- public static <R> Stream<R> zip(int[] a, int[] b, int valueForNoneA, int valueForNoneB, IntBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(int[] a, int[] b, int[] c, int valueForNoneA, int valueForNoneB, int valueForNoneC, IntTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(IntIterator a, IntIterator b, int valueForNoneA, int valueForNoneB, IntBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(IntIterator a, IntIterator b, IntIterator c, int valueForNoneA, int valueForNoneB, int valueForNoneC, IntTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(IntStream a, IntStream b, int valueForNoneA, int valueForNoneB, IntBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(IntStream a, IntStream b, IntStream c, int valueForNoneA, int valueForNoneB, int valueForNoneC, IntTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(java.util.Collection<? extends IntStream> c, int[] valuesForNone, IntNFunction<R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <R> Stream<R> zip(long[] a, long[] b, LongBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(long[] a, long[] b, long[] c, LongTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongIterator c, LongTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(LongStream a, LongStream b, LongBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(LongStream a, LongStream b, LongStream c, LongTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(java.util.Collection<? extends LongStream> c, LongNFunction<R> zipFunction)
c
- zipFunction
- public static <R> Stream<R> zip(long[] a, long[] b, long valueForNoneA, long valueForNoneB, LongBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(long[] a, long[] b, long[] c, long valueForNoneA, long valueForNoneB, long valueForNoneC, LongTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(LongIterator a, LongIterator b, long valueForNoneA, long valueForNoneB, LongBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(LongIterator a, LongIterator b, LongIterator c, long valueForNoneA, long valueForNoneB, long valueForNoneC, LongTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(LongStream a, LongStream b, long valueForNoneA, long valueForNoneB, LongBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(LongStream a, LongStream b, LongStream c, long valueForNoneA, long valueForNoneB, long valueForNoneC, LongTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(java.util.Collection<? extends LongStream> c, long[] valuesForNone, LongNFunction<R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <R> Stream<R> zip(float[] a, float[] b, FloatBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(float[] a, float[] b, float[] c, FloatTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatIterator c, FloatTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatStream c, FloatTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(java.util.Collection<? extends FloatStream> c, FloatNFunction<R> zipFunction)
c
- zipFunction
- public static <R> Stream<R> zip(float[] a, float[] b, float valueForNoneA, float valueForNoneB, FloatBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(float[] a, float[] b, float[] c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, float valueForNoneA, float valueForNoneB, FloatBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(FloatIterator a, FloatIterator b, FloatIterator c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(FloatStream a, FloatStream b, float valueForNoneA, float valueForNoneB, FloatBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(FloatStream a, FloatStream b, FloatStream c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(java.util.Collection<? extends FloatStream> c, float[] valuesForNone, FloatNFunction<R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <R> Stream<R> zip(double[] a, double[] b, DoubleBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(double[] a, double[] b, double[] c, DoubleTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleIterator c, DoubleTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleBiFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleStream c, DoubleTriFunction<R> zipFunction)
a
- b
- public static <R> Stream<R> zip(java.util.Collection<? extends DoubleStream> c, DoubleNFunction<R> zipFunction)
c
- zipFunction
- public static <R> Stream<R> zip(double[] a, double[] b, double valueForNoneA, double valueForNoneB, DoubleBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(double[] a, double[] b, double[] c, double valueForNoneA, double valueForNoneB, double valueForNoneC, DoubleTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, double valueForNoneA, double valueForNoneB, DoubleBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(DoubleIterator a, DoubleIterator b, DoubleIterator c, double valueForNoneA, double valueForNoneB, double valueForNoneC, DoubleTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, double valueForNoneA, double valueForNoneB, DoubleBiFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(DoubleStream a, DoubleStream b, DoubleStream c, double valueForNoneA, double valueForNoneB, double valueForNoneC, DoubleTriFunction<R> zipFunction)
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
- public static <R> Stream<R> zip(java.util.Collection<? extends DoubleStream> c, double[] valuesForNone, DoubleNFunction<R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <A,B,R> Stream<R> zip(A[] a, B[] b, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- public static <A,B,C,R> Stream<R> zip(A[] a, B[] b, C[] c, TriFunction<? super A,? super B,? super C,R> zipFunction)
a
- b
- public static <A,B,R> Stream<R> zip(java.util.Collection<? extends A> a, java.util.Collection<? extends B> b, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- public static <A,B,C,R> Stream<R> zip(java.util.Collection<? extends A> a, java.util.Collection<? extends B> b, java.util.Collection<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction)
a
- b
- public static <A,B,R> Stream<R> zip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- public static <A,B,C,R> Stream<R> zip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, java.util.Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction)
a
- b
- public static <A,B,R> Stream<R> zip(Stream<? extends A> a, Stream<? extends B> b, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- 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)
a
- b
- public static <T,R> Stream<R> zip(java.util.Collection<? extends Stream<? extends T>> c, Function<? super java.util.List<? extends T>,R> zipFunction)
c
- zipFunction
- public static <T,R> Stream<R> zip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, Function<? super java.util.List<? extends T>,R> zipFunction)
public static <A,B,R> Stream<R> zip(A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction)
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
- 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)
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
- public static <A,B,R> Stream<R> zip(java.util.Collection<? extends A> a, java.util.Collection<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction)
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
- public static <A,B,C,R> Stream<R> zip(java.util.Collection<? extends A> a, java.util.Collection<? extends B> b, java.util.Collection<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction)
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
- public static <A,B,R> Stream<R> zip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction)
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
- public static <A,B,C,R> Stream<R> zip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, java.util.Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction)
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
- 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)
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
- 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)
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
- public static <T,R> Stream<R> zip(java.util.Collection<? extends Stream<? extends T>> c, java.lang.Object[] valuesForNone, Function<? super java.util.List<? extends T>,R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <T,R> Stream<R> zip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, java.lang.Object[] valuesForNone, Function<? super java.util.List<? extends T>,R> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static <A,B,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, BiFunction<? super A,? super B,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- zipFunction
- public static <A,B,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, BiFunction<? super A,? super B,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <A,B,C,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, java.util.Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction)
public static <A,B,C,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, java.util.Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <A,B,R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, BiFunction<? super A,? super B,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- zipFunction
- public static <A,B,R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, BiFunction<? super A,? super B,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- zipFunction
- queueSize
- for each iterator. Default value is 8public 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)
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 queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <T,R> Stream<R> parallelZip(java.util.Collection<? extends Stream<? extends T>> c, Function<? super java.util.List<? extends T>,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
c
- zipFunction
- public static <T,R> Stream<R> parallelZip(java.util.Collection<? extends Stream<? extends T>> c, Function<? super java.util.List<? extends T>,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <T,R> Stream<R> parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, Function<? super java.util.List<? extends T>,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
c
- zipFunction
- public static <T,R> Stream<R> parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, Function<? super java.util.List<? extends T>,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <A,B,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- valueForNoneA
- valueForNoneB
- zipFunction
- public static <A,B,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- valueForNoneA
- valueForNoneB
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <A,B,C,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, java.util.Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- valueForNoneA
- valueForNoneB
- valueForNoneC
- zipFunction
- public static <A,B,C,R> Stream<R> parallelZip(java.util.Iterator<? extends A> a, java.util.Iterator<? extends B> b, java.util.Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- valueForNoneA
- valueForNoneB
- valueForNoneC
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <A,B,R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- valueForNoneA
- valueForNoneB
- zipFunction
- 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 queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- valueForNoneA
- valueForNoneB
- zipFunction
- queueSize
- for each iterator. Default value is 8public 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)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- valueForNoneA
- valueForNoneB
- valueForNoneC
- zipFunction
- 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 queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
a
- b
- c
- valueForNoneA
- valueForNoneB
- valueForNoneC
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <T,R> Stream<R> parallelZip(java.util.Collection<? extends Stream<? extends T>> c, java.lang.Object[] valuesForNone, Function<? super java.util.List<? extends T>,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
c
- valuesForNone
- zipFunction
- public static <T,R> Stream<R> parallelZip(java.util.Collection<? extends Stream<? extends T>> c, java.lang.Object[] valuesForNone, Function<? super java.util.List<? extends T>,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
c
- valuesForNone
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <T,R> Stream<R> parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, java.lang.Object[] valuesForNone, Function<? super java.util.List<? extends T>,R> zipFunction)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
c
- valuesForNone
- zipFunction
- public static <T,R> Stream<R> parallelZip2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, java.lang.Object[] valuesForNone, Function<? super java.util.List<? extends T>,R> zipFunction, int queueSize)
try (Stream stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
c
- valuesForNone
- zipFunction
- queueSize
- for each iterator. Default value is 8public static <T,L,R> Pair<Stream<L>,Stream<R>> unzip(java.util.Collection<? extends T> c, BiConsumer<? super T,Pair<L,R>> unzip)
c
- unzip
- the second parameter is an output parameter.public static <T,L,R> Pair<Stream<L>,Stream<R>> unzip(java.util.Iterator<? extends T> iter, BiConsumer<? super T,Pair<L,R>> unzip)
iter
- unzip
- the second parameter is an output parameter.public static <T,L,M,R> Triple<Stream<L>,Stream<M>,Stream<R>> unzip3(java.util.Collection<? extends T> c, BiConsumer<? super T,Triple<L,M,R>> unzip)
c
- unzip
- the second parameter is an output parameter.public static <T,L,M,R> Triple<Stream<L>,Stream<M>,Stream<R>> unzip3(java.util.Iterator<? extends T> iter, BiConsumer<? super T,Triple<L,M,R>> unzip)
iter
- unzip
- the second parameter is an output parameter.public static <T> Stream<T> merge(T[] a, T[] b, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
a
- b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge(T[] a, T[] b, T[] c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
a
- b
- c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge(java.util.Collection<? extends T> a, java.util.Collection<? extends T> b, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
a
- b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge(java.util.Collection<? extends T> a, java.util.Collection<? extends T> b, java.util.Collection<? extends T> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
a
- b
- c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge(java.util.Iterator<? extends T> a, java.util.Iterator<? extends T> b, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
a
- b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge(java.util.Iterator<? extends T> a, java.util.Iterator<? extends T> b, java.util.Iterator<? extends T> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
a
- b
- c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge(Stream<? extends T> a, Stream<? extends T> b, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
a
- b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge(Stream<? extends T> a, Stream<? extends T> b, Stream<? extends T> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
public static <T> Stream<T> merge(java.util.Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> merge2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> parallelMerge(java.util.Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> parallelMerge(java.util.Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector, int maxThreadNum)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.maxThreadNum
- public static <T> Stream<T> parallelMerge2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> parallelMerge2(java.util.Collection<? extends java.util.Iterator<? extends T>> c, BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector, int maxThreadNum)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.maxThreadNum
- public S carry(C action)
BaseStream
peek
carry
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.peek(Object)
public OT findAny(P predicate)
BaseStream
Optional
describing some element of the stream, or an
empty Optional
if the stream is empty.
This is a short-circuiting terminal operation.
The behavior of this operation is explicitly nondeterministic; it is
free to select any element in the stream. This is to allow for maximal
performance in parallel operations; the cost is that multiple invocations
on the same source may not return the same result. (If a stable result
is desired, use #findFirst()
instead.)
findAny
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
Optional
describing some element of this stream, or an
empty Optional
if the stream is empty#findFirst()
public Stream<S> sliding(int windowSize)
sliding
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.sliding(int, int)
public void println()
println
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public boolean isParallel()
BaseStream
isParallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
true
if this stream would execute in parallel if executedpublic S sequential()
BaseStream
sequential
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public S parallel()
BaseStream
parallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.parallel(int, Splitor)
public S parallel(int maxThreadNum)
BaseStream
maxThreadNum
as the specified one.parallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.parallel(int, Splitor)
public S parallel(BaseStream.Splitor splitor)
BaseStream
splitor
as the specified one.parallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.parallel(int, Splitor)
public int maxThreadNum()
BaseStream
maxThreadNum
if the stream is parallel, otherwise 1
is returned.maxThreadNum
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public S maxThreadNum(int maxThreadNum)
BaseStream
maxThreadNum
. Or return
itself, either because the stream was already parallel with same maxThreadNum
, or because
it's a sequential stream.maxThreadNum
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public BaseStream.Splitor splitor()
BaseStream
splitor
if the stream is parallel, otherwise the default value splitor.ITERATOR
is returned.splitor
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public S splitor(BaseStream.Splitor splitor)
BaseStream
splitor
. Or return
itself, either because the stream was already parallel with same splitor
, or because
it's a sequential stream.splitor
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public Try<S> tried()
tried
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public void close()
BaseStream
close
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
close
in interface java.lang.AutoCloseable
AutoCloseable.close()