T
- the type of the stream elementspublic abstract class Stream<T>
extends java.lang.Object
It's designed to service your purposes: Do what you want and returns what you expected. Try the best to adopt the the design principles of Java 8 Stream APIs, but won't has to obey every rule.A sequence of elements supporting sequential and parallel aggregate operations. The following example illustrates an aggregate operation using
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.)
IntStream
,
LongStream
,
DoubleStream
Modifier and Type | Class and Description |
---|---|
static class |
Stream.LAIO
LAIO = Loading All Intermediate Operations.
|
static class |
Stream.LRNO
LAIO = Loading Right Now 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 <E extends java.lang.Exception> |
allMatch(Try.Predicate<? super T,E> predicate) |
abstract <U,E extends java.lang.Exception> |
allMatch(U seed,
Try.BiPredicate<? super T,? super U,E> predicate) |
abstract <E extends java.lang.Exception> |
anyMatch(Try.Predicate<? super T,E> predicate) |
abstract <U,E extends java.lang.Exception> |
anyMatch(U seed,
Try.BiPredicate<? super T,? super U,E> 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 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()
Stream.of(1, 2, 3).combinations().forEach(Fn.println());
// output
[]
[1]
[2]
[3]
[1, 2]
[1, 3]
[2, 3]
[1, 2, 3]
|
abstract Stream<java.util.List<T>> |
combinations(int len)
Stream.of(1, 2, 3).combinations(2).forEach(Fn.println());
// output
[1, 2]
[1, 3]
[2, 3]
|
abstract Stream<java.util.List<T>> |
combinations(int len,
boolean repeat)
It's same as
N.cartesianProduct(N.repeat(toList(), len)) if repeat is true . |
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> |
concatt(java.util.Collection<? extends java.util.Iterator<? extends T>> c) |
abstract boolean |
containsAll(java.util.Collection<? extends T> c) |
abstract boolean |
containsAll(T... a) |
<K> Stream<java.util.Map.Entry<K,java.lang.Integer>> |
countBy(Function<? super T,? extends K> classifier) |
<K> EntryStream<K,java.lang.Integer> |
countByToEntry(Function<? super T,? extends K> classifier) |
abstract Stream<T> |
difference(Function<? super T,?> mapper,
java.util.Collection<?> c)
Except with the specified Collection by the values mapped by
mapper . |
Stream<T> |
distinct(Predicate<? super java.lang.Long> occurrencesFilter)
Distinct and filter by occurrences.
|
abstract Stream<T> |
distinctBy(Function<? super T,?> keyExtractor)
Distinct by the value mapped from
keyExtractor |
<K> Stream<T> |
distinctBy(Function<? super T,K> keyExtractor,
Predicate<? super java.lang.Long> occurrencesFilter)
Distinct and filter by occurrences.
|
abstract <U> Stream<T> |
dropWhile(U seed,
BiPredicate<? super T,? super U> predicate) |
abstract <U> Stream<T> |
dropWhile(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> |
empty() |
abstract <U> Stream<T> |
filter(U seed,
BiPredicate<? super T,? super U> predicate) |
abstract <E extends java.lang.Exception> |
findAny(Try.Predicate<? super T,E> predicate) |
abstract <U,E extends java.lang.Exception> |
findAny(U seed,
Try.BiPredicate<? super T,? super U,E> predicate) |
abstract <E extends java.lang.Exception> |
findFirst(Try.Predicate<? super T,E> predicate) |
abstract <U,E extends java.lang.Exception> |
findFirst(U seed,
Try.BiPredicate<? super T,? super U,E> predicate) |
abstract <U,E extends java.lang.Exception,E2 extends java.lang.Exception> |
findFirstOrLast(Function<? super T,U> preFunc,
Try.BiPredicate<? super T,? super U,E> predicateForFirst,
Try.BiPredicate<? super T,? super U,E2> predicateForLast)
This method only run sequentially, even in parallel stream. |
abstract <E extends java.lang.Exception,E2 extends java.lang.Exception> |
findFirstOrLast(Try.Predicate<? super T,E> predicateForFirst,
Try.Predicate<? super T,E2> predicateForLast) |
abstract <U,E extends java.lang.Exception,E2 extends java.lang.Exception> |
findFirstOrLast(U seed,
Try.BiPredicate<? super T,? super U,E> predicateForFirst,
Try.BiPredicate<? super T,? super U,E2> predicateForLast)
This method only run sequentially, even in parallel stream. |
abstract <E extends java.lang.Exception> |
findLast(Try.Predicate<? super T,E> predicate) |
abstract <U,E extends java.lang.Exception> |
findLast(U seed,
Try.BiPredicate<? super T,? super U,E> predicate) |
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 <R> Stream<R> |
flatMapp(Function<? super T,R[]> mapper) |
abstract <U,R> Stream<R> |
flatMapp(U seed,
BiFunction<? super T,? super U,R[]> mapper) |
abstract <K,V> EntryStream<K,V> |
flatMappToEntry(Function<? super T,? extends EntryStream<K,V>> 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> Stream<R> |
flattMap(Function<? super T,? extends java.util.Collection<? extends R>> mapper) |
abstract <U,R> Stream<R> |
flattMap(U seed,
BiFunction<? super T,? super U,? extends java.util.Collection<? extends R>> mapper) |
abstract <K,V> EntryStream<K,V> |
flattMapToEntry(Function<? super T,? extends java.util.Map<K,V>> mapper) |
abstract <E extends java.lang.Exception> |
forEach(Try.Consumer<? super T,E> action) |
abstract <E extends java.lang.Exception> |
forEachPair(Try.BiConsumer<? super T,? super T,E> action) |
abstract <E extends java.lang.Exception> |
forEachPair(Try.BiConsumer<? super T,? super T,E> action,
int increment)
Slide with
windowSize = 2 and the specified increment , then consume by the specified mapper . |
abstract <E extends java.lang.Exception> |
forEachTriple(Try.TriConsumer<? super T,? super T,? super T,E> action) |
abstract <E extends java.lang.Exception> |
forEachTriple(Try.TriConsumer<? super T,? super T,? super T,E> 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<? extends 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,A,D> Stream<java.util.Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Collector<? super U,A,D> downstream) |
abstract <K,U,A,D> Stream<java.util.Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Collector<? super U,A,D> downstream,
Supplier<? extends 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,
Supplier<? extends java.util.Map<K,java.util.List<U>>> mapFactory) |
abstract <K,V> Stream<java.util.Map.Entry<K,V>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction) |
abstract <K,V> Stream<java.util.Map.Entry<K,V>> |
groupBy(Function<? super T,? extends K> classifier,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction,
Supplier<? extends java.util.Map<K,V>> mapFactory) |
abstract <K> Stream<java.util.Map.Entry<K,java.util.List<T>>> |
groupBy(Function<? super T,? extends K> classifier,
Supplier<? extends 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<? extends 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,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Collector<? super U,A,D> downstream) |
abstract <K,U,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Collector<? super U,A,D> downstream,
Supplier<? extends 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,
Supplier<? extends java.util.Map<K,java.util.List<U>>> mapFactory) |
abstract <K,V> EntryStream<K,V> |
groupByToEntry(Function<? super T,? extends K> classifier,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction,
Supplier<? extends java.util.Map<K,V>> mapFactory) |
abstract <K> EntryStream<K,java.util.List<T>> |
groupByToEntry(Function<? super T,? extends K> classifier,
Supplier<? extends 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 Optional<T> |
head()
Head and tail should be used by pair.
|
abstract Pair<Optional<T>,Stream<T>> |
headAndTail() |
abstract Pair<Stream<T>,Optional<T>> |
headAndTaill()
Deprecated.
|
abstract Stream<T> |
headd()
Deprecated.
|
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(BooleanSupplier hasNext,
Supplier<? extends T> next) |
static <T> Stream<T> |
iterate(T seed,
BooleanSupplier 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,
Predicate<T> hasNext,
UnaryOperator<T> f) |
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 Optional<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 Optional<T> |
max(java.util.Comparator<? super T> comparator)
Returns the maximum element of this stream according to the provided
Comparator . |
Optional<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> |
mergge(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
BiFunction<? super T,? super T,com.landawn.abacus.util.Nth> nextSelector) |
abstract Optional<T> |
min(java.util.Comparator<? super T> comparator)
Returns the minimum element of this stream according to the provided
Comparator . |
Optional<T> |
minBy(Function<? super T,? extends java.lang.Comparable> keyExtractor) |
abstract <E extends java.lang.Exception> |
noneMatch(Try.Predicate<? super T,E> predicate) |
abstract <U,E extends java.lang.Exception> |
noneMatch(U seed,
Try.BiPredicate<? super T,? super U,E> 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)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static <T> Try<Stream<T>> |
of(java.lang.Class<T> targetClass,
java.sql.ResultSet resultSet,
boolean closeResultSet) |
static <T> Stream<T> |
of(java.lang.Class<T> targetClass,
RowIterator rowIterator)
It's user's responsibility to close the input
rowIterator after the stream is finished. |
static <T> Try<Stream<T>> |
of(java.lang.Class<T> targetClass,
RowIterator rowIterator,
boolean closeRowIterator) |
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.lang.Iterable<? extends T> iterable) |
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 Try<Stream<java.lang.Object[]>> |
of(java.sql.ResultSet resultSet,
boolean closeResultSet) |
static <T> Stream<T> |
of(java.sql.ResultSet resultSet,
int columnIndex)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static <T> Try<Stream<T>> |
of(java.sql.ResultSet resultSet,
int columnIndex,
boolean closeResultSet) |
static <T> Stream<T> |
of(java.sql.ResultSet resultSet,
java.lang.String columnName)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static <T> Try<Stream<T>> |
of(java.sql.ResultSet resultSet,
java.lang.String columnName,
boolean closeResultSet) |
static Stream<java.lang.Object[]> |
of(RowIterator rowIterator)
It's user's responsibility to close the input
rowIterator after the stream is finished. |
static Try<Stream<java.lang.Object[]>> |
of(RowIterator rowIterator,
boolean closeRowIterator) |
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> |
ofKeys(java.util.Map<T,?> map) |
static <T,V> Stream<T> |
ofKeys(java.util.Map<T,V> map,
Predicate<? super V> valueFilter) |
static <T> Stream<T> |
ofNullable(T t) |
static <T> Stream<T> |
ofValues(java.util.Map<?,T> map) |
static <K,T> Stream<T> |
ofValues(java.util.Map<K,T> map,
Predicate<? super K> keyFilter) |
abstract Stream<java.util.List<T>> |
orderedPermutations()
Stream.of(1, 2, 3).orderedPermutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
|
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> |
parallelConcatt(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> |
parallelConcatt(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> |
parallelConcatt(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> |
parallelMergge(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> |
parallelMergge(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> |
parallelZipp(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> |
parallelZipp(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> |
parallelZipp(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> |
parallelZipp(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 Stream<java.util.Map.Entry<java.lang.Boolean,java.util.List<T>>> |
partitionBy(Predicate<? super T> predicate) |
abstract <A,D> Stream<java.util.Map.Entry<java.lang.Boolean,D>> |
partitionBy(Predicate<? super T> predicate,
Collector<? super T,A,D> downstream) |
abstract EntryStream<java.lang.Boolean,java.util.List<T>> |
partitionByToEntry(Predicate<? super T> predicate) |
abstract <A,D> EntryStream<java.lang.Boolean,D> |
partitionByToEntry(Predicate<? super T> predicate,
Collector<? super T,A,D> downstream) |
abstract java.util.Map<java.lang.Boolean,java.util.List<T>> |
partitionTo(Predicate<? super T> predicate) |
abstract <A,D> java.util.Map<java.lang.Boolean,D> |
partitionTo(Predicate<? super T> predicate,
Collector<? super T,A,D> downstream) |
abstract Stream<T> |
peekFirst(Consumer<? super T> action) |
abstract Stream<T> |
peekLast(Consumer<? super T> action) |
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()
Stream.of(1, 2, 3).permutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[3, 1, 2]
[3, 2, 1]
[2, 3, 1]
[2, 1, 3]
|
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 <E extends java.lang.Exception> |
persist(java.io.File file,
Try.Function<? super T,java.lang.String,E> toLine) |
abstract <E extends java.lang.Exception> |
persist(java.io.OutputStream os,
Try.Function<? super T,java.lang.String,E> 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 <E extends java.lang.Exception> |
persist(java.io.Writer writer,
Try.Function<? super T,java.lang.String,E> 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 Optional<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)
Deprecated.
|
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) |
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.
|
S |
shuffled()
This method only run sequentially, even in parallel stream and all elements will be loaded to memory. |
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 <C extends java.util.Collection<T>> |
sliding(int windowSize,
IntFunction<C> collectionSupplier) |
abstract <C extends java.util.Collection<T>> |
sliding(int windowSize,
int increment,
IntFunction<C> collectionSupplier) |
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(BiFunction<? super T,? super T,R> mapper,
int increment,
boolean ignoreNotPaired) |
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 <R> Stream<R> |
slidingMap(TriFunction<? super T,? super T,? super T,R> mapper,
int increment,
boolean ignoreNotPaired) |
Stream<PL> |
slidingToList(int windowSize) |
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) |
abstract Stream<T> |
sortedByDouble(ToDoubleFunction<? super T> keyExtractor) |
abstract Stream<T> |
sortedByInt(ToIntFunction<? super T> keyExtractor) |
abstract Stream<T> |
sortedByLong(ToLongFunction<? super T> keyExtractor) |
abstract <C extends java.util.Collection<T>> |
split(int size,
IntFunction<C> collectionSupplier)
Returns Stream of Stream with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
|
abstract <C extends java.util.Collection<T>> |
split(Predicate<? super T> predicate,
Supplier<C> collectionSupplier) |
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.
|
abstract <U,C extends java.util.Collection<T>> |
split(U seed,
BiPredicate<? super T,? super U> predicate,
Consumer<? super U> seedUpdate,
Supplier<C> collectionSupplier)
Split the stream by the specified predicate.
|
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.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 Stream<java.util.Set<T>> |
splitToSet(Predicate<? super T> predicate) |
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 Optional<T> |
taill()
Deprecated.
|
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,V> ImmutableMap<K,V> |
toImmutableMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends V> valueMapper) |
<K,V> ImmutableMap<K,V> |
toImmutableMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction) |
ImmutableSet<T> |
toImmutableSet() |
abstract java.util.stream.Stream<T> |
toJdkStream() |
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,A,D> java.util.Map<K,D> |
toMap(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Collector<? super U,A,D> downstream) |
abstract <K,U,A,D,M extends java.util.Map<K,D>> |
toMap(Function<? super T,? extends K> classifier,
Function<? super T,? extends U> valueMapper,
Collector<? super U,A,D> downstream,
Supplier<M> mapFactory) |
abstract <K,V> java.util.Map<K,V> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends V> valueMapper) |
abstract <K,V> java.util.Map<K,V> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction) |
abstract <K,V,M extends java.util.Map<K,V>> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction,
Supplier<M> mapFactory) |
abstract <K,V,M extends java.util.Map<K,V>> |
toMap(Function<? super T,? extends K> keyExtractor,
Function<? super T,? extends V> 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() |
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> |
zipp(java.util.Collection<? extends java.util.Iterator<? extends T>> c,
Function<? super java.util.List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
zipp(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
append, cached, count, difference, distinct, dropWhile, dropWhile, filter, first, indexed, intersection, join, join, last, limit, onClose, parallel, peek, percentiles, prepend, removeIf, removeIf, reversed, reverseSorted, rotated, shuffled, skip, skip, sliding, slidingToList, sorted, split, split, split, splitAt, splitBy, splitToList, splitToList, splitToList, step, symmetricDifference, takeWhile, toArray, toCollection, toList, toLongMultiset, toLongMultiset, toMultiset, toMultiset, toSet
@ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported public abstract <U> Stream<T> dropWhile(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)
@ParallelSupported public abstract <U> Stream<T> removeIf(U seed, BiPredicate<? super T,? super U> predicate)
@ParallelSupported public abstract <U> Stream<T> removeIf(U seed, BiPredicate<? super T,? super U> predicate, Consumer<? super T> consumer)
@ParallelSupported public <U> Stream<U> select(java.lang.Class<U> targetType)
targetType
- @ParallelSupported 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 element@ParallelSupported public abstract <U,R> Stream<R> map(U seed, BiFunction<? super T,? super U,? extends R> mapper)
@ParallelSupported public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper)
@ParallelSupported 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
- @ParallelSupported public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper, int increment, boolean ignoreNotPaired)
@ParallelSupported public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper)
@ParallelSupported 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
- @ParallelSupported public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper, int increment, boolean ignoreNotPaired)
@SequentialOnly 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)
@ParallelSupported public abstract Stream<T> mapFirst(Function<? super T,? extends T> mapperForFirst)
@ParallelSupported public abstract <R> Stream<R> mapFirstOrElse(Function<? super T,? extends R> mapperForFirst, Function<? super T,? extends R> mapperForElse)
@ParallelSupported public abstract Stream<T> mapLast(Function<? super T,? extends T> mapperForLast)
@ParallelSupported public abstract <R> Stream<R> mapLastOrElse(Function<? super T,? extends R> mapperForLast, Function<? super T,? extends R> mapperForElse)
@ParallelSupported public abstract CharStream mapToChar(ToCharFunction<? super T> mapper)
@ParallelSupported public abstract ByteStream mapToByte(ToByteFunction<? super T> mapper)
@ParallelSupported public abstract ShortStream mapToShort(ToShortFunction<? super T> mapper)
@ParallelSupported 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 element@ParallelSupported public 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 element@ParallelSupported public abstract FloatStream mapToFloat(ToFloatFunction<? super T> mapper)
@ParallelSupported 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 element@ParallelSupported public abstract <K,V> EntryStream<K,V> mapToEntry(Function<? super T,? extends java.util.Map.Entry<K,V>> mapper)
@ParallelSupported public abstract <K,V> EntryStream<K,V> mapToEntry(Function<? super T,K> keyMapper, Function<? super T,V> valueMapper)
@ParallelSupported 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 values@ParallelSupported public abstract <U,R> Stream<R> flatMap(U seed, BiFunction<? super T,? super U,? extends Stream<? extends R>> mapper)
@ParallelSupported public abstract <R> Stream<R> flattMap(Function<? super T,? extends java.util.Collection<? extends R>> mapper)
@ParallelSupported public abstract <U,R> Stream<R> flattMap(U seed, BiFunction<? super T,? super U,? extends java.util.Collection<? extends R>> mapper)
@ParallelSupported public abstract <U,R> Stream<R> flatMapp(U seed, BiFunction<? super T,? super U,R[]> mapper)
@ParallelSupported public abstract CharStream flatMapToChar(Function<? super T,? extends CharStream> mapper)
@ParallelSupported public abstract ByteStream flatMapToByte(Function<? super T,? extends ByteStream> mapper)
@ParallelSupported public abstract ShortStream flatMapToShort(Function<? super T,? extends ShortStream> mapper)
@ParallelSupported 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)
@ParallelSupported 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)
@ParallelSupported public abstract FloatStream flatMapToFloat(Function<? super T,? extends FloatStream> mapper)
@ParallelSupported 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)
@ParallelSupported public abstract <K,V> EntryStream<K,V> flatMapToEntry(Function<? super T,? extends Stream<? extends java.util.Map.Entry<K,V>>> mapper)
@ParallelSupported public abstract <K,V> EntryStream<K,V> flattMapToEntry(Function<? super T,? extends java.util.Map<K,V>> mapper)
@ParallelSupported public abstract <K,V> EntryStream<K,V> flatMappToEntry(Function<? super T,? extends EntryStream<K,V>> mapper)
@ParallelSupported public abstract <K> Stream<java.util.Map.Entry<K,java.util.List<T>>> groupBy(Function<? super T,? extends K> classifier)
@ParallelSupported public abstract <K> Stream<java.util.Map.Entry<K,java.util.List<T>>> groupBy(Function<? super T,? extends K> classifier, Supplier<? extends java.util.Map<K,java.util.List<T>>> mapFactory)
@ParallelSupported 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)
@ParallelSupported 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<? extends java.util.Map<K,java.util.List<U>>> mapFactory)
classifier
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
@ParallelSupported 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)
@ParallelSupported 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<? extends java.util.Map<K,D>> mapFactory)
@ParallelSupported public abstract <K,U,A,D> Stream<java.util.Map.Entry<K,D>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Collector<? super U,A,D> downstream)
@ParallelSupported public abstract <K,U,A,D> Stream<java.util.Map.Entry<K,D>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Collector<? super U,A,D> downstream, Supplier<? extends java.util.Map<K,D>> mapFactory)
@ParallelSupported public abstract <K,V> Stream<java.util.Map.Entry<K,V>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
@ParallelSupported public abstract <K,V> Stream<java.util.Map.Entry<K,V>> groupBy(Function<? super T,? extends K> classifier, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends java.util.Map<K,V>> mapFactory)
@ParallelSupported public abstract Stream<java.util.Map.Entry<java.lang.Boolean,java.util.List<T>>> partitionBy(Predicate<? super T> predicate)
predicate
- Collectors.partitioningBy(Predicate)
@ParallelSupported public abstract <A,D> Stream<java.util.Map.Entry<java.lang.Boolean,D>> partitionBy(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
predicate
- downstream
- Collectors.partitioningBy(Predicate, Collector)
public <K> Stream<java.util.Map.Entry<K,java.lang.Integer>> countBy(Function<? super T,? extends K> classifier)
@ParallelSupported public abstract <K> EntryStream<K,java.util.List<T>> groupByToEntry(Function<? super T,? extends K> classifier)
@ParallelSupported public abstract <K> EntryStream<K,java.util.List<T>> groupByToEntry(Function<? super T,? extends K> classifier, Supplier<? extends java.util.Map<K,java.util.List<T>>> mapFactory)
@ParallelSupported 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)
@ParallelSupported public abstract <K,U> EntryStream<K,java.util.List<U>> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Supplier<? extends java.util.Map<K,java.util.List<U>>> mapFactory)
classifier
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
@ParallelSupported public abstract <K,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream)
@ParallelSupported public abstract <K,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream, Supplier<? extends java.util.Map<K,D>> mapFactory)
@ParallelSupported public abstract <K,U,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Collector<? super U,A,D> downstream)
@ParallelSupported public abstract <K,U,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Collector<? super U,A,D> downstream, Supplier<? extends java.util.Map<K,D>> mapFactory)
@ParallelSupported public abstract <K,U> EntryStream<K,U> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, BinaryOperator<U> mergeFunction)
@ParallelSupported public abstract <K,V> EntryStream<K,V> groupByToEntry(Function<? super T,? extends K> classifier, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends java.util.Map<K,V>> mapFactory)
@ParallelSupported public abstract EntryStream<java.lang.Boolean,java.util.List<T>> partitionByToEntry(Predicate<? super T> predicate)
predicate
- Collectors.partitioningBy(Predicate)
@ParallelSupported public abstract <A,D> EntryStream<java.lang.Boolean,D> partitionByToEntry(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
predicate
- downstream
- Collectors.partitioningBy(Predicate, Collector)
public <K> EntryStream<K,java.lang.Integer> countByToEntry(Function<? super T,? extends K> classifier)
@SequentialOnly public abstract Stream<T> collapse(BiPredicate<? super T,? super T> collapsible, BiFunction<? super T,? super T,T> mergeFunction)
Example:
Stream.of(new Integer[0]).collapse((a, b) -> a < b, (a, b) -> a + b) => []
Stream.of(1).collapse((a, b) -> a < b, (a, b) -> a + b) => [1]
Stream.of(1, 2).collapse((a, b) -> a < b, (a, b) -> a + b) => [3]
Stream.of(1, 2, 3).collapse((a, b) -> a < b, (a, b) -> a + b) => [6]
Stream.of(1, 2, 3, 3, 2, 1).collapse((a, b) -> a < b, (a, b) -> a + b) => [6, 3, 2, 1]
collapsible
- mergeFunction
- @SequentialOnly public abstract <R,A> Stream<R> collapse(BiPredicate<? super T,? super T> collapsible, Collector<? super T,A,R> collector)
Example:
Stream.of(new Integer[0]).collapse((a, b) -> a < b, Collectors.summingInt(Fn.unboxI())) => []
Stream.of(1).collapse((a, b) -> a < b, Collectors.summingInt(Fn.unboxI())) => [1]
Stream.of(1, 2).collapse((a, b) -> a < b, Collectors.summingInt(Fn.unboxI())) => [3]
Stream.of(1, 2, 3).collapse((a, b) -> a < b, Collectors.summingInt(Fn.unboxI())) => [6]
Stream.of(1, 2, 3, 3, 2, 1).collapse((a, b) -> a < b, Collectors.summingInt(Fn.unboxI())) => [6, 3, 2, 1]
collapsible
- collector
- @SequentialOnly 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:
Stream.of(new Integer[0]).scan((a, b) -> a + b) => []
Stream.of(1).scan((a, b) -> a + b) => [1]
Stream.of(1, 2).scan((a, b) -> a + b) => [1, 3]
Stream.of(1, 2, 3).scan((a, b) -> a + b) => [1, 3, 6]
Stream.of(1, 2, 3, 3, 2, 1).scan((a, b) -> a + b) => [1, 3, 6, 9, 11, 12]
accumulator
- the accumulation function@SequentialOnly public 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:
Stream.of(new Integer[0]).scan(10, (a, b) -> a + b) => []
Stream.of(1).scan(10, (a, b) -> a + b) => [11]
Stream.of(1, 2).scan(10, (a, b) -> a + b) => [11, 13]
Stream.of(1, 2, 3).scan(10, (a, b) -> a + b) => [11, 13, 16]
Stream.of(1, 2, 3, 3, 2, 1).scan(10, (a, b) -> a + b) => [11, 13, 16, 19, 21, 22]
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 function@SequentialOnly public abstract Stream<java.util.Set<T>> splitToSet(int size)
size
- @SequentialOnly public abstract Stream<java.util.Set<T>> splitToSet(Predicate<? super T> predicate)
@SequentialOnly 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);
seed
- predicate
- seedUpdate
- @SequentialOnly public abstract <C extends java.util.Collection<T>> Stream<C> split(int size, IntFunction<C> collectionSupplier)
size
- collectionSupplier
- @SequentialOnly public abstract <C extends java.util.Collection<T>> Stream<C> split(Predicate<? super T> predicate, Supplier<C> collectionSupplier)
@SequentialOnly public abstract <U,C extends java.util.Collection<T>> Stream<C> split(U seed, BiPredicate<? super T,? super U> predicate, Consumer<? super U> seedUpdate, Supplier<C> collectionSupplier)
// split the number sequence by window 5.
Stream.of(1, 2, 3, 5, 7, 9, 10, 11, 19).split(MutableInt.of(5), (e, b) -> e <= b.intValue(), b -> b.addAndGet(5), Suppliers.ofList).forEach(N::println);
seed
- predicate
- seedUpdate
- collectionSupplier
- @SequentialOnly public abstract <C extends java.util.Collection<T>> Stream<C> sliding(int windowSize, IntFunction<C> collectionSupplier)
@SequentialOnly public abstract <C extends java.util.Collection<T>> Stream<C> sliding(int windowSize, int increment, IntFunction<C> collectionSupplier)
@SequentialOnly public abstract Stream<T> intersperse(T delimiter)
Stream.of(1).intersperse(9) --> [1]
Stream.of(1, 2, 3).intersperse(9) --> [1, 9, 2, 9, 3]
delimiter
- public Stream<T> distinct(Predicate<? super java.lang.Long> occurrencesFilter)
occurrencesFilter
- @ParallelSupported public abstract Stream<T> distinctBy(Function<? super T,?> keyExtractor)
keyExtractor
keyExtractor
- don't change value of the input parameter.public <K> Stream<T> distinctBy(Function<? super T,K> keyExtractor, Predicate<? super java.lang.Long> occurrencesFilter)
keyExtractor
- occurrencesFilter
- @SequentialOnly public abstract Stream<T> top(int n)
n
- @SequentialOnly public abstract Stream<T> top(int n, java.util.Comparator<? super T> comparator)
n
- comparator
- @ParallelSupported 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 elements@ParallelSupported public abstract Stream<T> sortedBy(Function<? super T,? extends java.lang.Comparable> keyExtractor)
@ParallelSupported public abstract Stream<T> sortedByInt(ToIntFunction<? super T> keyExtractor)
@ParallelSupported public abstract Stream<T> sortedByLong(ToLongFunction<? super T> keyExtractor)
@ParallelSupported public abstract Stream<T> sortedByDouble(ToDoubleFunction<? super T> keyExtractor)
@ParallelSupported public abstract <E extends java.lang.Exception> void forEach(Try.Consumer<? super T,E> action) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> void forEachPair(Try.BiConsumer<? super T,? super T,E> action) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> void forEachPair(Try.BiConsumer<? super T,? super T,E> action, int increment) throws E extends java.lang.Exception
windowSize = 2
and the specified increment
, then consume
by the specified mapper
.mapper
- increment
- E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> void forEachTriple(Try.TriConsumer<? super T,? super T,? super T,E> action) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> void forEachTriple(Try.TriConsumer<? super T,? super T,? super T,E> action, int increment) throws E extends java.lang.Exception
windowSize = 3
and the specified increment
, then consume
by the specified mapper
.mapper
- increment
- E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> boolean anyMatch(Try.Predicate<? super T,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> boolean allMatch(Try.Predicate<? super T,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> boolean noneMatch(Try.Predicate<? super T,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> Optional<T> findFirst(Try.Predicate<? super T,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> Optional<T> findLast(Try.Predicate<? super T,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@SequentialOnly public abstract <E extends java.lang.Exception,E2 extends java.lang.Exception> Optional<T> findFirstOrLast(Try.Predicate<? super T,E> predicateForFirst, Try.Predicate<? super T,E2> predicateForLast) throws E extends java.lang.Exception, E2 extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <E extends java.lang.Exception> Optional<T> findAny(Try.Predicate<? super T,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <U,E extends java.lang.Exception> Optional<T> findFirst(U seed, Try.BiPredicate<? super T,? super U,E> predicate) throws E extends java.lang.Exception
seed
- predicate
- E extends java.lang.Exception
@ParallelSupported public abstract <U,E extends java.lang.Exception> Optional<T> findLast(U seed, Try.BiPredicate<? super T,? super U,E> predicate) throws E extends java.lang.Exception
seed
- predicate
- E extends java.lang.Exception
@ParallelSupported public abstract <U,E extends java.lang.Exception> Optional<T> findAny(U seed, Try.BiPredicate<? super T,? super U,E> predicate) throws E extends java.lang.Exception
seed
- predicate
- E extends java.lang.Exception
@SequentialOnly public abstract <U,E extends java.lang.Exception,E2 extends java.lang.Exception> Optional<T> findFirstOrLast(U seed, Try.BiPredicate<? super T,? super U,E> predicateForFirst, Try.BiPredicate<? super T,? super U,E2> predicateForLast) throws E extends java.lang.Exception, E2 extends java.lang.Exception
seed
- predicateForFirst
- predicateForLast
- E extends java.lang.Exception
@SequentialOnly public abstract <U,E extends java.lang.Exception,E2 extends java.lang.Exception> Optional<T> findFirstOrLast(Function<? super T,U> preFunc, Try.BiPredicate<? super T,? super U,E> predicateForFirst, Try.BiPredicate<? super T,? super U,E2> predicateForLast) throws E extends java.lang.Exception, E2 extends java.lang.Exception
preFunc
- predicateForFirst
- predicateForLast
- E extends java.lang.Exception
@ParallelSupported public abstract <U,E extends java.lang.Exception> boolean anyMatch(U seed, Try.BiPredicate<? super T,? super U,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <U,E extends java.lang.Exception> boolean allMatch(U seed, Try.BiPredicate<? super T,? super U,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@ParallelSupported public abstract <U,E extends java.lang.Exception> boolean noneMatch(U seed, Try.BiPredicate<? super T,? super U,E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
@SequentialOnly public abstract boolean containsAll(T... a)
@SequentialOnly public abstract boolean containsAll(java.util.Collection<? extends T> c)
@SequentialOnly 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 stream@ParallelSupported public <K,V> ImmutableMap<K,V> toImmutableMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends V> valueMapper)
keyExtractor
- valueMapper
- Collectors.toMap(Function, Function)
@ParallelSupported public <K,V> ImmutableMap<K,V> toImmutableMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
keyExtractor
- valueMapper
- mergeFunction
- Collectors.toMap(Function, Function)
@ParallelSupported public abstract <K,V> java.util.Map<K,V> toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends V> valueMapper)
keyExtractor
- valueMapper
- Collectors.toMap(Function, Function)
@ParallelSupported public abstract <K,V> java.util.Map<K,V> toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
keyExtractor
- valueMapper
- mergeFunction
- Collectors.toMap(Function, Function, BinaryOperator)
@ParallelSupported public abstract <K,V,M extends java.util.Map<K,V>> M toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends V> valueMapper, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mapFactory
- Collectors.toMap(Function, Function, Supplier)
@ParallelSupported public abstract <K,V,M extends java.util.Map<K,V>> M toMap(Function<? super T,? extends K> keyExtractor, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mergeFunction
- mapFactory
- Collectors.toMap(Function, Function, BinaryOperator, Supplier)
@ParallelSupported 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)
@ParallelSupported 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)
@ParallelSupported public abstract <K,U,A,D> java.util.Map<K,D> toMap(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Collector<? super U,A,D> downstream)
classifier
- valueMapper
- downstream
- Collectors.groupingBy(Function, Collector)
@ParallelSupported public abstract <K,U,A,D,M extends java.util.Map<K,D>> M toMap(Function<? super T,? extends K> classifier, Function<? super T,? extends U> valueMapper, Collector<? super U,A,D> downstream, Supplier<M> mapFactory)
classifier
- valueMapper
- downstream
- mapFactory
- Collectors.groupingBy(Function, Collector, Supplier)
@ParallelSupported public abstract <K> java.util.Map<K,java.util.List<T>> groupTo(Function<? super T,? extends K> classifier)
classifier
- Collectors.groupingBy(Function)
@ParallelSupported 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)
@ParallelSupported 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)
@ParallelSupported 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)
@ParallelSupported public abstract java.util.Map<java.lang.Boolean,java.util.List<T>> partitionTo(Predicate<? super T> predicate)
predicate
- Collectors.partitioningBy(Predicate)
@ParallelSupported public abstract <A,D> java.util.Map<java.lang.Boolean,D> partitionTo(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
predicate
- downstream
- Collectors.partitioningBy(Predicate, Collector)
@ParallelSupported public abstract <K> ListMultimap<K,T> toMultimap(Function<? super T,? extends K> keyExtractor)
keyExtractor
- Collectors.toMultimap(Function, Function)
@ParallelSupported 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)
@ParallelSupported 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)
@ParallelSupported 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)
@SequentialOnly public abstract DataSet toDataSet()
@SequentialOnly public abstract DataSet toDataSet(boolean isFirstHeader)
isFirstHeader
- @SequentialOnly 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.@ParallelSupported 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 values@ParallelSupported public abstract Optional<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 ? Optional.of(result) : Optional.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)
@ParallelSupported 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)
@Deprecated @ParallelSupported 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.@ParallelSupported 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 function@ParallelSupported public 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.@ParallelSupported 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
@ParallelSupported public abstract <R,A> R collect(java.util.stream.Collector<? super T,A,R> collector)
@ParallelSupported public abstract <R,A,RR> RR collectAndThen(Collector<? super T,A,R> downstream, Function<R,RR> finisher)
@ParallelSupported public abstract <R,A,RR> RR collectAndThen(java.util.stream.Collector<? super T,A,R> downstream, Function<R,RR> finisher)
@SequentialOnly public abstract <R> R toListAndThen(Function<? super java.util.List<T>,R> func)
@SequentialOnly public abstract <R> R toSetAndThen(Function<? super java.util.Set<T>,R> func)
@SequentialOnly public abstract Optional<T> head()
@SequentialOnly public abstract Stream<T> tail()
@Deprecated @SequentialOnly public abstract Stream<T> headd()
@Deprecated @SequentialOnly public abstract Optional<T> taill()
@Deprecated @SequentialOnly public abstract Pair<Stream<T>,Optional<T>> headAndTaill()
@SequentialOnly 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
- @SequentialOnly 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
- @ParallelSupported public abstract Optional<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 empty@ParallelSupported public Optional<T> minBy(Function<? super T,? extends java.lang.Comparable> keyExtractor)
@ParallelSupported public abstract Optional<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 empty@ParallelSupported public Optional<T> maxBy(Function<? super T,? extends java.lang.Comparable> keyExtractor)
@ParallelSupported public abstract Optional<T> kthLargest(int k, java.util.Comparator<? super T> comparator)
k
- comparator
- @ParallelSupported public abstract int sumInt(ToIntFunction<? super T> mapper)
@ParallelSupported public abstract long sumLong(ToLongFunction<? super T> mapper)
@ParallelSupported public abstract double sumDouble(ToDoubleFunction<? super T> mapper)
@ParallelSupported public abstract OptionalDouble averageInt(ToIntFunction<? super T> mapper)
@ParallelSupported public abstract OptionalDouble averageLong(ToLongFunction<? super T> mapper)
@ParallelSupported public abstract OptionalDouble averageDouble(ToDoubleFunction<? super T> mapper)
@SequentialOnly public abstract Optional<java.util.Map<com.landawn.abacus.util.Percentage,T>> percentiles(java.util.Comparator<? super T> comparator)
@SequentialOnly public abstract Stream<java.util.List<T>> combinations()
Stream.of(1, 2, 3).combinations().forEach(Fn.println());
// output
[]
[1]
[2]
[3]
[1, 2]
[1, 3]
[2, 3]
[1, 2, 3]
@SequentialOnly public abstract Stream<java.util.List<T>> combinations(int len)
Stream.of(1, 2, 3).combinations(2).forEach(Fn.println());
// output
[1, 2]
[1, 3]
[2, 3]
len
- @SequentialOnly public abstract Stream<java.util.List<T>> combinations(int len, boolean repeat)
N.cartesianProduct(N.repeat(toList(), len))
if repeat
is true
.
Stream.of(1, 2, 3).combinations(2, true).forEach(Fn.println());
// output
[1, 1]
[1, 2]
[1, 3]
[2, 1]
[2, 2]
[2, 3]
[3, 1]
[3, 2]
[3, 3]
len
- repeat
- @SequentialOnly public abstract Stream<java.util.List<T>> permutations()
Stream.of(1, 2, 3).permutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[3, 1, 2]
[3, 2, 1]
[2, 3, 1]
[2, 1, 3]
@SequentialOnly public abstract Stream<java.util.List<T>> orderedPermutations()
Stream.of(1, 2, 3).orderedPermutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
@SequentialOnly public abstract Stream<java.util.List<T>> orderedPermutations(java.util.Comparator<? super T> comparator)
@SequentialOnly @SafeVarargs public final Stream<java.util.List<T>> cartesianProduct(java.util.Collection<? extends T>... cs)
@SequentialOnly public abstract Stream<java.util.List<T>> cartesianProduct(java.util.Collection<? extends java.util.Collection<? extends T>> cs)
@ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported 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
- @ParallelSupported 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
- @SequentialOnly public abstract boolean hasDuplicates()
@ParallelSupported public abstract Stream<T> intersection(Function<? super T,?> mapper, java.util.Collection<?> c)
mapper
.mapper
- c
- IntList.intersection(IntList)
@ParallelSupported public abstract Stream<T> difference(Function<? super T,?> mapper, java.util.Collection<?> c)
mapper
.mapper
- c
- IntList.difference(IntList)
@SequentialOnly public abstract Stream<T> cached(IntFunction<T[]> generator)
generator
- @SequentialOnly public abstract Stream<T> queued(int queueSize)
queueSize
- Default value is 8@SequentialOnly public 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.@SequentialOnly public abstract <T2,R> Stream<R> zipWith(Stream<T2> b, BiFunction<? super T,? super T2,R> zipFunction)
@SequentialOnly public abstract <T2,T3,R> Stream<R> zipWith(Stream<T2> b, Stream<T3> c, TriFunction<? super T,? super T2,? super T3,R> zipFunction)
@SequentialOnly public abstract <T2,R> Stream<R> zipWith(Stream<T2> b, T valueForNoneA, T2 valueForNoneB, BiFunction<? super T,? super T2,R> zipFunction)
@SequentialOnly 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)
@SequentialOnly public abstract <E extends java.lang.Exception> long persist(java.io.File file, Try.Function<? super T,java.lang.String,E> toLine) throws E extends java.lang.Exception
E extends java.lang.Exception
@SequentialOnly public abstract <E extends java.lang.Exception> long persist(java.io.OutputStream os, Try.Function<? super T,java.lang.String,E> toLine) throws E extends java.lang.Exception
E extends java.lang.Exception
@SequentialOnly public abstract <E extends java.lang.Exception> long persist(java.io.Writer writer, Try.Function<? super T,java.lang.String,E> toLine) throws E extends java.lang.Exception
E extends java.lang.Exception
@SequentialOnly 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)
@SequentialOnly public abstract long persist(java.sql.PreparedStatement stmt, int batchSize, int batchInterval, Try.BiConsumer<? super java.sql.PreparedStatement,? super T,java.sql.SQLException> stmtSetter)
@SequentialOnly public abstract java.util.stream.Stream<T> toJdkStream()
@SequentialOnly public ObjIterator<T> iterator()
BaseStream
@SequentialOnly @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.lang.Iterable<? extends T> iterable)
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(RowIterator rowIterator)
rowIterator
after the stream is finished.rowIterator
- public static Try<Stream<java.lang.Object[]>> of(RowIterator rowIterator, boolean closeRowIterator)
public static <T> Stream<T> of(java.lang.Class<T> targetClass, RowIterator rowIterator)
rowIterator
after the stream is finished.targetClass
- rowIterator
- public static <T> Try<Stream<T>> of(java.lang.Class<T> targetClass, RowIterator rowIterator, boolean closeRowIterator)
public static Stream<java.lang.Object[]> of(java.sql.ResultSet resultSet)
resultSet
after the stream is finished.resultSet
- public static Try<Stream<java.lang.Object[]>> of(java.sql.ResultSet resultSet, boolean closeResultSet)
public static <T> Stream<T> of(java.lang.Class<T> targetClass, java.sql.ResultSet resultSet)
resultSet
after the stream is finished.targetClass
- resultSet
- public static <T> Try<Stream<T>> of(java.lang.Class<T> targetClass, java.sql.ResultSet resultSet, boolean closeResultSet)
public static <T> Stream<T> of(java.sql.ResultSet resultSet, int columnIndex)
resultSet
after the stream is finished.resultSet
- columnIndex
- starts from 0, not 1.public static <T> Try<Stream<T>> of(java.sql.ResultSet resultSet, int columnIndex, boolean closeResultSet)
resultSet
- columnIndex
- starts from 0, not 1.closeResultSet
- public static <T> Stream<T> of(java.sql.ResultSet resultSet, java.lang.String columnName)
resultSet
after the stream is finished.resultSet
- columnName
- public static <T> Try<Stream<T>> of(java.sql.ResultSet resultSet, java.lang.String columnName, boolean closeResultSet)
resultSet
- columnName
- closeResultSet
- 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> ofKeys(java.util.Map<T,?> map)
public static <T,V> Stream<T> ofKeys(java.util.Map<T,V> map, Predicate<? super V> valueFilter)
public static <T> Stream<T> ofValues(java.util.Map<?,T> map)
public static <K,T> Stream<T> ofValues(java.util.Map<K,T> map, Predicate<? super K> keyFilter)
public static <T> Stream<T> repeat(T element, long n)
public static <T> Stream<T> iterate(BooleanSupplier hasNext, Supplier<? extends T> next)
public static <T> Stream<T> iterate(T seed, BooleanSupplier 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> concatt(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> parallelConcatt(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> parallelConcatt(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> parallelConcatt(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> zipp(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> zipp(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> parallelZipp(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> parallelZipp(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> parallelZipp(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> parallelZipp(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> 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> mergge(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> parallelMergge(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> parallelMergge(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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
BaseStream.peek(Object)
public Stream<S> sliding(int windowSize)
sliding
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
BaseStream.sliding(int, int)
public Stream<PL> slidingToList(int windowSize)
slidingToList
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
BaseStream.sliding(int, int)
public S shuffled()
BaseStream
shuffled
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
public ImmutableList<T> toImmutableList()
toImmutableList
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
public ImmutableSet<T> toImmutableSet()
toImmutableSet
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
public void println()
println
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
public boolean isParallel()
BaseStream
isParallel
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
public S parallel()
BaseStream
parallel
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,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,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
public Try<S> tried()
tried
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
public void close()
BaseStream
close
in interface BaseStream<T,A,P,C,PL,OT,IT,ITER,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,ITER,S>>
close
in interface java.lang.AutoCloseable
AutoCloseable.close()