T
- the type of the stream elementspublic abstract class Stream<T> extends Object
BaseStream
,
IntStream
,
LongStream
,
DoubleStream
Modifier and Type | Class and Description |
---|---|
static class |
Stream.StreamEx<T> |
BaseStream.Splitor
Modifier and Type | Method and Description |
---|---|
<SS extends BaseStream> |
__(Function<? super Stream<T>,SS> transfer) |
abstract <E extends Exception> |
allMatch(Throwables.Predicate<? super T,E> predicate) |
abstract <E extends Exception> |
anyMatch(Throwables.Predicate<? super T,E> predicate) |
abstract Stream<T> |
append(Collection<? extends T> c) |
Stream<T> |
append(T... a) |
abstract Stream<T> |
appendIfEmpty(Collection<? extends T> c) |
Stream<T> |
appendIfEmpty(T... a) |
<R,E extends Exception> |
asyncCall(Throwables.Function<? super Stream<T>,R,E> action) |
<R,E extends Exception> |
asyncCall(Throwables.Function<? super Stream<T>,R,E> action,
Executor executor) |
<E extends Exception> |
asyncRun(Throwables.Consumer<? super Stream<T>,E> action) |
<E extends Exception> |
asyncRun(Throwables.Consumer<? super Stream<T>,E> action,
Executor executor) |
abstract u.OptionalDouble |
averageDouble(ToDoubleFunction<? super T> mapper) |
abstract u.OptionalDouble |
averageInt(ToIntFunction<? super T> mapper) |
abstract u.OptionalDouble |
averageLong(ToLongFunction<? super T> mapper) |
S |
carry(C action)
Same as
peek |
abstract Stream<List<T>> |
cartesianProduct(Collection<? extends Collection<? extends T>> cs) |
Stream<List<T>> |
cartesianProduct(Collection<? extends T>... cs) |
<E extends Exception> |
checked() |
<E extends Exception> |
checked(Class<E> cls) |
void |
close() |
abstract Stream<Stream<T>> |
collapse(BiPredicate<? super T,? super T> collapsible) |
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 <C extends Collection<T>> |
collapse(BiPredicate<? super T,? super T> collapsible,
Supplier<? extends C> supplier) |
abstract <R> Stream<R> |
collapse(BiPredicate<? super T,? super T> collapsible,
Supplier<R> supplier,
BiConsumer<? super R,? super T> accumulator) |
abstract <U> Stream<U> |
collapse(BiPredicate<? super T,? super T> collapsible,
U init,
BiFunction<U,? super T,U> op) |
abstract <R,A> R |
collect(Collector<? super T,A,R> collector) |
abstract <R,A> R |
collect(Collector<? super T,A,R> collector) |
abstract <R> R |
collect(Supplier<R> supplier,
BiConsumer<? super R,? super T> accumulator) |
abstract <R> R |
collect(Supplier<R> supplier,
BiConsumer<? super R,? super T> accumulator,
BiConsumer<R,R> combiner) |
abstract <R,A,RR,E extends Exception> |
collectAndThen(Collector<? super T,A,R> downstream,
Throwables.Function<? super R,RR,E> func) |
abstract <R,A,RR,E extends Exception> |
collectAndThen(Collector<? super T,A,R> downstream,
Throwables.Function<? super R,RR,E> func) |
abstract Stream<List<T>> |
combinations()
Stream.of(1, 2, 3).combinations().forEach(Fn.println());
// output
[]
[1]
[2]
[3]
[1, 2]
[1, 3]
[2, 3]
[1, 2, 3]
|
abstract Stream<List<T>> |
combinations(int len)
Stream.of(1, 2, 3).combinations(2).forEach(Fn.println());
// output
[1, 2]
[1, 3]
[2, 3]
|
abstract Stream<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(Collection<? extends Stream<? extends T>> c) |
static <T> Stream<T> |
concat(Collection<? extends T>... a) |
static <T> Stream<T> |
concat(Iterator<? extends T>... a) |
static <T> Stream<T> |
concat(List<? extends Collection<? extends T>> c) |
static <T> Stream<T> |
concat(Stream<? extends T>... a) |
static <T> Stream<T> |
concat(T[]... a) |
static <T> Stream<T> |
concatt(Collection<? extends Iterator<? extends T>> c) |
abstract boolean |
containsAll(Collection<? extends T> c) |
abstract boolean |
containsAll(T... a) |
abstract boolean |
containsAny(Collection<? extends T> c) |
abstract boolean |
containsAny(T... a) |
<K> Stream<Map.Entry<K,Integer>> |
countBy(Function<? super T,? extends K> keyMapper) |
<K> EntryStream<K,Integer> |
countByToEntry(Function<? super T,? extends K> keyMapper) |
abstract <U> Stream<Pair<T,U>> |
crossJoin(Collection<? extends U> b) |
abstract <U,R> Stream<R> |
crossJoin(Collection<? extends U> b,
BiFunction<? super T,? super U,R> func) |
abstract <U,R> Stream<R> |
crossJoin(Stream<? extends U> b,
BiFunction<? super T,? super U,R> func) |
abstract Stream<T> |
cycled() |
abstract Stream<T> |
cycled(long times) |
Stream<T> |
defaultIfEmpty(Supplier<? extends Stream<T>> supplier) |
Stream<T> |
defaultIfEmpty(T defaultValue) |
abstract Stream<T> |
difference(Function<? super T,?> mapper,
Collection<?> c)
Except with the specified Collection by the values mapped by
mapper . |
Stream<T> |
distinct(Predicate<? super Long> occurrencesFilter)
Distinct and filter by occurrences.
|
abstract Stream<T> |
distinctBy(Function<? super T,?> keyMapper)
Distinct by the value mapped from
keyMapper |
<K> Stream<T> |
distinctBy(Function<? super T,K> keyMapper,
BinaryOperator<T> mergeFunction)
Distinct and filter by occurrences.
|
<K> Stream<T> |
distinctBy(Function<? super T,K> keyMapper,
Predicate<? super Long> occurrencesFilter)
Distinct and filter by occurrences.
|
static <T> Stream<T> |
empty() |
abstract <E extends Exception> |
findAny(Throwables.Predicate<? super T,E> predicate) |
abstract <E extends Exception> |
findFirst(Throwables.Predicate<? super T,E> predicate) |
abstract <U,E extends Exception,E2 extends Exception> |
findFirstOrLast(Function<? super T,U> preFunc,
Throwables.BiPredicate<? super T,? super U,E> predicateForFirst,
Throwables.BiPredicate<? super T,? super U,E2> predicateForLast)
This method only run sequentially, even in parallel stream. |
abstract <E extends Exception,E2 extends Exception> |
findFirstOrLast(Throwables.Predicate<? super T,E> predicateForFirst,
Throwables.Predicate<? super T,E2> predicateForLast) |
abstract <U,E extends Exception,E2 extends Exception> |
findFirstOrLast(U init,
Throwables.BiPredicate<? super T,? super U,E> predicateForFirst,
Throwables.BiPredicate<? super T,? super U,E2> predicateForLast)
This method only run sequentially, even in parallel stream. |
abstract <E extends Exception> |
findLast(Throwables.Predicate<? super T,E> predicate)
Consider using:
stream.reversed().findFirst(predicate) for better performance if possible. |
abstract <R> Stream<R> |
flatMap(Function<? super T,? extends Stream<? extends R>> mapper) |
abstract <R> Stream<R> |
flatMapp(Function<? super T,R[]> mapper) |
abstract <K,V> EntryStream<K,V> |
flatMappToEntry(Function<? super T,? extends EntryStream<? extends K,? extends 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) |
abstract <K,V> EntryStream<K,V> |
flatMapToEntry(Function<? super T,? extends Stream<? extends Map.Entry<? extends K,? extends V>>> mapper) |
abstract FloatStream |
flatMapToFloat(Function<? super T,? extends FloatStream> mapper) |
abstract IntStream |
flatMapToInt(Function<? super T,? extends IntStream> mapper) |
abstract LongStream |
flatMapToLong(Function<? super T,? extends LongStream> mapper) |
abstract ShortStream |
flatMapToShort(Function<? super T,? extends ShortStream> mapper) |
static <T> Stream<T> |
flatten(Collection<? extends Collection<? extends T>> c) |
static <T> Stream<T> |
flatten(T[][] a) |
static <T> Stream<T> |
flatten(T[][][] a) |
static <T> Stream<T> |
flatten(T[][] a,
boolean vertically) |
static <T> Stream<T> |
flatten(T[][] a,
T valueForNone,
boolean vertically) |
abstract <R> Stream<R> |
flattMap(Function<? super T,? extends Collection<? extends R>> mapper) |
abstract ByteStream |
flattMapToByte(Function<? super T,byte[]> mapper) |
abstract CharStream |
flattMapToChar(Function<? super T,char[]> mapper) |
abstract DoubleStream |
flattMapToDouble(Function<? super T,double[]> mapper) |
abstract <K,V> EntryStream<K,V> |
flattMapToEntry(Function<? super T,? extends Map<? extends K,? extends V>> mapper) |
abstract FloatStream |
flattMapToFloat(Function<? super T,float[]> mapper) |
abstract IntStream |
flattMapToInt(Function<? super T,int[]> mapper) |
abstract LongStream |
flattMapToLong(Function<? super T,long[]> mapper) |
abstract ShortStream |
flattMapToShort(Function<? super T,short[]> mapper) |
abstract <E extends Exception> |
forEach(Throwables.Consumer<? super T,E> action) |
abstract <E extends Exception,E2 extends Exception> |
forEach(Throwables.Consumer<? super T,E> action,
Throwables.Runnable<E2> onComplete) |
abstract <U,E extends Exception,E2 extends Exception> |
forEach(Throwables.Function<? super T,? extends Collection<? extends U>,E> flatMapper,
Throwables.BiConsumer<? super T,? super U,E2> action) |
abstract <T2,T3,E extends Exception,E2 extends Exception,E3 extends Exception> |
forEach(Throwables.Function<? super T,? extends Collection<T2>,E> flatMapper,
Throwables.Function<? super T2,? extends Collection<T3>,E2> flatMapper2,
Throwables.TriConsumer<? super T,? super T2,? super T3,E3> action) |
abstract <E extends Exception> |
forEachIndexed(Throwables.IndexedConsumer<? super T,E> action) |
abstract <E extends Exception> |
forEachPair(Throwables.BiConsumer<? super T,? super T,E> action) |
abstract <E extends Exception> |
forEachPair(Throwables.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 Exception> |
forEachTriple(Throwables.TriConsumer<? super T,? super T,? super T,E> action) |
abstract <E extends Exception> |
forEachTriple(Throwables.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 <K,R> Stream<R> |
fullJoin(Collection<? extends T> b,
Function<? super T,? extends K> keyMapper,
BiFunction<? super T,? super T,R> func)
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(Collection<? extends 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,K> Stream<Pair<T,U>> |
fullJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> 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 <U,K,R> Stream<R> |
fullJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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,K,R> Stream<R> |
fullJoin(Stream<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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> supplier) |
abstract <K> Stream<Map.Entry<K,List<T>>> |
groupBy(Function<? super T,? extends K> keyMapper) |
abstract <K,A,D> Stream<Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> keyMapper,
Collector<? super T,A,D> downstream) |
abstract <K,A,D> Stream<Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> keyMapper,
Collector<? super T,A,D> downstream,
Supplier<? extends Map<K,D>> mapFactory) |
abstract <K,V> Stream<Map.Entry<K,List<V>>> |
groupBy(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
abstract <K,V> Stream<Map.Entry<K,V>> |
groupBy(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction) |
abstract <K,V> Stream<Map.Entry<K,V>> |
groupBy(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction,
Supplier<? extends Map<K,V>> mapFactory) |
abstract <K,V,A,D> Stream<Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Collector<? super V,A,D> downstream) |
abstract <K,V,A,D> Stream<Map.Entry<K,D>> |
groupBy(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Collector<? super V,A,D> downstream,
Supplier<? extends Map<K,D>> mapFactory) |
abstract <K,V> Stream<Map.Entry<K,List<V>>> |
groupBy(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Supplier<? extends Map<K,List<V>>> mapFactory) |
abstract <K> Stream<Map.Entry<K,List<T>>> |
groupBy(Function<? super T,? extends K> keyMapper,
Supplier<? extends Map<K,List<T>>> mapFactory) |
abstract <K> EntryStream<K,List<T>> |
groupByToEntry(Function<? super T,? extends K> keyMapper) |
abstract <K,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Collector<? super T,A,D> downstream) |
abstract <K,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Collector<? super T,A,D> downstream,
Supplier<? extends Map<K,D>> mapFactory) |
abstract <K,V> EntryStream<K,List<V>> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
abstract <K,V> EntryStream<K,V> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction) |
abstract <K,V> EntryStream<K,V> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction,
Supplier<? extends Map<K,V>> mapFactory) |
abstract <K,V,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Collector<? super V,A,D> downstream) |
abstract <K,V,A,D> EntryStream<K,D> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Collector<? super V,A,D> downstream,
Supplier<? extends Map<K,D>> mapFactory) |
abstract <K,V> EntryStream<K,List<V>> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Supplier<? extends Map<K,List<V>>> mapFactory) |
abstract <K> EntryStream<K,List<T>> |
groupByToEntry(Function<? super T,? extends K> keyMapper,
Supplier<? extends Map<K,List<T>>> mapFactory) |
abstract <K,R> Stream<R> |
groupJoin(Collection<? extends T> b,
Function<? super T,? extends K> keyMapper,
BiFunction<? super T,? super List<T>,R> func)
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,K> Stream<Pair<T,List<U>>> |
groupJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper) |
abstract <U,K,R> Stream<R> |
groupJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super List<U>,R> func) |
abstract <U,K> Stream<Pair<T,U>> |
groupJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BinaryOperator<U> mergeFunction) |
abstract <U,K,R> Stream<R> |
groupJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BinaryOperator<U> mergeFunction,
BiFunction<? super T,? super U,R> func) |
abstract <U,K,A,D> Stream<Pair<T,D>> |
groupJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
Collector<? super U,A,D> downstream) |
abstract <U,K,A,D,R> |
groupJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
Collector<? super U,A,D> downstream,
BiFunction<? super T,? super D,R> func) |
abstract <U,K,R> Stream<R> |
groupJoin(Stream<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super List<U>,R> func) |
abstract <U,K,R> Stream<R> |
groupJoin(Stream<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BinaryOperator<U> mergeFunction,
BiFunction<? super T,? super U,R> func) |
abstract <U,K,A,D,R> |
groupJoin(Stream<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
Collector<? super U,A,D> downstream,
BiFunction<? super T,? super D,R> func) |
abstract <K> Map<K,List<T>> |
groupTo(Function<? super T,? extends K> keyMapper) |
abstract <K,V> Map<K,List<V>> |
groupTo(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
abstract <K,V,M extends Map<K,List<V>>> |
groupTo(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Supplier<? extends M> mapFactory) |
abstract <K,M extends Map<K,List<T>>> |
groupTo(Function<? super T,? extends K> keyMapper,
Supplier<? extends M> mapFactory) |
abstract boolean |
hasDuplicates() |
abstract <K,R> Stream<R> |
innerJoin(Collection<? extends T> b,
Function<? super T,? extends K> keyMapper,
BiFunction<? super T,? super T,R> func)
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(Collection<? extends 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,K> Stream<Pair<T,U>> |
innerJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> 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 <U,K,R> Stream<R> |
innerJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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,K,R> Stream<R> |
innerJoin(Stream<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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,
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,
TimeUnit unit,
LongFunction<T> s) |
static <T> Stream<T> |
interval(long delay,
long interval,
TimeUnit unit,
Supplier<T> s) |
static <T> Stream<T> |
interval(long intervalInMillis,
Supplier<T> s) |
boolean |
isParallel() |
static <T> Stream<T> |
iterate(BooleanSupplier hasNext,
Supplier<? extends T> next) |
static <T> Stream<T> |
iterate(T init,
BooleanSupplier hasNext,
UnaryOperator<T> f)
Returns a sequential ordered
Stream produced by iterative
application of a function f to an initial element init ,
producing a Stream consisting of init , f(init) ,
f(f(init)) , etc. |
static <T> Stream<T> |
iterate(T init,
Predicate<? super T> hasNext,
UnaryOperator<T> f) |
static <T> Stream<T> |
iterate(T init,
UnaryOperator<T> f) |
ObjIterator<T> |
iterator()
Remember to close this Stream after the iteration is done, if needed.
|
String |
join(CharSequence delimiter) |
static <T> Stream<T> |
just(T a) |
abstract u.Optional<T> |
kthLargest(int k,
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 <K,R> Stream<R> |
leftJoin(Collection<? extends T> b,
Function<? super T,? extends K> keyMapper,
BiFunction<? super T,? super T,R> func)
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(Collection<? extends 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,K> Stream<Pair<T,U>> |
leftJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> 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 <U,K,R> Stream<R> |
leftJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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,K,R> Stream<R> |
leftJoin(Stream<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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<String> |
lines(File file) |
static Stream<String> |
lines(File file,
Charset charset) |
static Stream<String> |
lines(Path path) |
static Stream<String> |
lines(Path path,
Charset charset) |
static Stream<String> |
lines(Reader reader)
It's user's responsibility to close the input
reader after the stream is finished. |
static Stream<File> |
listFiles(File parentPath) |
static Stream<File> |
listFiles(File parentPath,
boolean recursively) |
abstract <R> Stream<R> |
map(Function<? super T,? 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 <K,V> Stream<NoCachingNoUpdating.DisposableEntry<K,V>> |
mapToDisposableEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper)
Deprecated.
|
abstract DoubleStream |
mapToDouble(ToDoubleFunction<? super T> mapper) |
abstract <K,V> EntryStream<K,V> |
mapToEntry(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
abstract <K,V> EntryStream<K,V> |
mapToEntry(Function<? super T,? extends Map.Entry<? extends K,? extends V>> mapper) |
abstract FloatStream |
mapToFloat(ToFloatFunction<? super T> mapper) |
abstract IntStream |
mapToInt(ToIntFunction<? super T> mapper) |
abstract LongStream |
mapToLong(ToLongFunction<? super T> mapper) |
abstract ShortStream |
mapToShort(ToShortFunction<? super T> mapper) |
abstract u.Optional<T> |
max(Comparator<? super T> comparator) |
u.Optional<T> |
maxBy(Function<? super T,? extends Comparable> keyMapper) |
static <T> Stream<T> |
merge(Collection<? extends Stream<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(Collection<? extends T> a,
Collection<? extends T> b,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(Collection<? extends T> a,
Collection<? extends T> b,
Collection<? extends T> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(Iterator<? extends T> a,
Iterator<? extends T> b,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(Iterator<? extends T> a,
Iterator<? extends T> b,
Iterator<? extends T> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(List<? extends Collection<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
abstract Stream<T> |
merge(Stream<? extends T> b,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(Stream<? extends T> a,
Stream<? extends T> b,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(Stream<? extends T> a,
Stream<? extends T> b,
Stream<? extends T> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(T[] a,
T[] b,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
merge(T[] a,
T[] b,
T[] c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
mergge(Collection<? extends Iterator<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
abstract u.Optional<T> |
min(Comparator<? super T> comparator) |
u.Optional<T> |
minBy(Function<? super T,? extends Comparable> keyMapper) |
abstract <E extends Exception> |
nMatch(long atLeast,
long atMost,
Throwables.Predicate<? super T,E> predicate) |
abstract <E extends Exception> |
noneMatch(Throwables.Predicate<? super T,E> predicate) |
static <T> Stream<T> |
observe(BlockingQueue<T> queue,
BooleanSupplier hasMore,
long maxWaitIntervalInMillis) |
static <T> Stream<T> |
observe(BlockingQueue<T> queue,
BooleanSupplier hasMore,
long maxWaitIntervalInMillis,
Runnable onComplete)
Sample code:
|
static <T> Stream<T> |
observe(BlockingQueue<T> queue,
Duration duration) |
static <T> Stream<T> |
observe(BlockingQueue<T> queue,
Duration duration,
Runnable onComplete)
Sample code:
|
static Stream<Boolean> |
of(boolean[] a) |
static Stream<Boolean> |
of(boolean[] a,
int fromIndex,
int toIndex) |
static Stream<Byte> |
of(byte[] a) |
static Stream<Byte> |
of(byte[] a,
int fromIndex,
int toIndex) |
static Stream<Character> |
of(char[] a) |
static Stream<Character> |
of(char[] a,
int fromIndex,
int toIndex) |
static <T> Stream<T> |
of(Collection<? extends T> c) |
static <T> Stream<T> |
of(Collection<? extends T> c,
int startIndex,
int endIndex) |
static Stream<Double> |
of(double[] a) |
static Stream<Double> |
of(double[] a,
int fromIndex,
int toIndex) |
static <T> Stream<T> |
of(Enumeration<? extends T> enumeration) |
static Stream<Float> |
of(float[] a) |
static Stream<Float> |
of(float[] a,
int fromIndex,
int toIndex) |
static Stream<Integer> |
of(int[] a) |
static Stream<Integer> |
of(int[] a,
int fromIndex,
int toIndex) |
static <T> Stream<T> |
of(Iterable<? extends T> iterable) |
static <T> Stream<T> |
of(Iterator<? extends T> iterator) |
static Stream<Long> |
of(long[] a) |
static Stream<Long> |
of(long[] a,
int fromIndex,
int toIndex) |
static <K,V> Stream<Map.Entry<K,V>> |
of(Map<K,V> map) |
static Stream<Short> |
of(short[] a) |
static Stream<Short> |
of(short[] a,
int fromIndex,
int toIndex) |
static <T> Stream<T> |
of(Stream<T> stream) |
static <T> Stream<T> |
of(Supplier<Collection<? extends T>> supplier)
Lazy evaluation.
|
static <T> Stream<T> |
of(T... a) |
static <T> Stream<T> |
of(T[] a,
int startIndex,
int endIndex) |
static <K> Stream<K> |
ofKeys(Map<K,?> map) |
static <K,V> Stream<K> |
ofKeys(Map<K,V> map,
Predicate<? super V> valueFilter) |
static <T> Stream<T> |
ofNullable(T t) |
static <V> Stream<V> |
ofValues(Map<?,V> map) |
static <K,V> Stream<V> |
ofValues(Map<K,V> map,
Predicate<? super K> keyFilter) |
abstract Stream<List<T>> |
orderedPermutations()
Stream.of(1, 2, 3).orderedPermutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
|
abstract Stream<List<T>> |
orderedPermutations(Comparator<? super T> comparator) |
S |
parallel() |
S |
parallel(BaseStream.Splitor splitor) |
S |
parallel(Executor executor) |
S |
parallel(int maxThreadNum) |
S |
parallel(int maxThreadNum,
BaseStream.Splitor splitor)
Returns an equivalent stream that is parallel.
|
S |
parallel(int maxThreadNum,
BaseStream.Splitor splitor,
Executor executor) |
S |
parallel(int maxThreadNum,
Executor executor) |
static <T> Stream<T> |
parallelConcat(Collection<? extends Stream<? extends T>> c) |
static <T> Stream<T> |
parallelConcat(Collection<? extends Stream<? extends T>> c,
int readThreadNum) |
static <T> Stream<T> |
parallelConcat(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(Iterator<? extends T>... a) |
static <T> Stream<T> |
parallelConcat(Iterator<? extends T>[] a,
int readThreadNum,
int queueSize) |
static <T> Stream<T> |
parallelConcat(List<? extends Collection<? extends T>> c) |
static <T> Stream<T> |
parallelConcat(List<? extends Collection<? extends T>> c,
int readThreadNum) |
static <T> Stream<T> |
parallelConcat(List<? extends Collection<? 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(Stream<? extends T>... a) |
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(Collection<? extends Iterator<? extends T>> c) |
static <T> Stream<T> |
parallelConcatt(Collection<? extends Iterator<? extends T>> c,
int readThreadNum) |
static <T> Stream<T> |
parallelConcatt(Collection<? extends Iterator<? extends T>> c,
int readThreadNum,
int queueSize) |
static <T> Stream<T> |
parallelMerge(Collection<? extends Stream<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
parallelMerge(Collection<? extends Stream<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector,
int maxThreadNum) |
static <T> Stream<T> |
parallelMerge(List<? extends Collection<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
parallelMerge(List<? extends Collection<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector,
int maxThreadNum) |
static <T> Stream<T> |
parallelMergge(Collection<? extends Iterator<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector) |
static <T> Stream<T> |
parallelMergge(Collection<? extends Iterator<? extends T>> c,
BiFunction<? super T,? super T,MergeResult> nextSelector,
int maxThreadNum) |
static <T,R> Stream<R> |
parallelZip(Collection<? extends Stream<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
parallelZip(Collection<? extends Stream<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction,
int queueSize) |
static <T,R> Stream<R> |
parallelZip(Collection<? extends Stream<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
parallelZip(Collection<? extends Stream<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction,
int queueSize) |
static <A,B,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
A valueForNoneA,
B valueForNoneB,
BiFunction<? super A,? super B,R> zipFunction) |
static <A,B,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
A valueForNoneA,
B valueForNoneB,
BiFunction<? super A,? super B,R> zipFunction,
int queueSize) |
static <A,B,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
BiFunction<? super A,? super B,R> zipFunction) |
static <A,B,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
BiFunction<? super A,? super B,R> zipFunction,
int queueSize) |
static <A,B,C,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
Iterator<? extends C> c,
A valueForNoneA,
B valueForNoneB,
C valueForNoneC,
TriFunction<? super A,? super B,? super C,R> zipFunction) |
static <A,B,C,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
Iterator<? extends C> c,
A valueForNoneA,
B valueForNoneB,
C valueForNoneC,
TriFunction<? super A,? super B,? super C,R> zipFunction,
int queueSize) |
static <A,B,C,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
Iterator<? extends C> c,
TriFunction<? super A,? super B,? super C,R> zipFunction) |
static <A,B,C,R> Stream<R> |
parallelZip(Iterator<? extends A> a,
Iterator<? extends B> b,
Iterator<? extends C> c,
TriFunction<? super A,? super B,? super C,R> zipFunction,
int queueSize) |
static <T,R> Stream<R> |
parallelZip(List<? extends Collection<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
parallelZip(List<? extends Collection<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction,
int queueSize) |
static <T,R> Stream<R> |
parallelZip(List<? extends Collection<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
parallelZip(List<? extends Collection<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction,
int queueSize) |
static <A,B,R> Stream<R> |
parallelZip(Stream<A> a,
Stream<B> b,
A valueForNoneA,
B valueForNoneB,
BiFunction<? super A,? super B,R> zipFunction) |
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) |
static <A,B,R> Stream<R> |
parallelZip(Stream<A> a,
Stream<B> b,
BiFunction<? super A,? super B,R> zipFunction) |
static <A,B,R> Stream<R> |
parallelZip(Stream<A> a,
Stream<B> b,
BiFunction<? super A,? super B,R> zipFunction,
int queueSize) |
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) |
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) |
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) |
static <T,R> Stream<R> |
parallelZipp(Collection<? extends Iterator<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
parallelZipp(Collection<? extends Iterator<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction,
int queueSize) |
static <T,R> Stream<R> |
parallelZipp(Collection<? extends Iterator<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
parallelZipp(Collection<? extends Iterator<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction,
int queueSize) |
abstract Stream<Map.Entry<Boolean,List<T>>> |
partitionBy(Predicate<? super T> predicate) |
abstract <A,D> Stream<Map.Entry<Boolean,D>> |
partitionBy(Predicate<? super T> predicate,
Collector<? super T,A,D> downstream) |
abstract EntryStream<Boolean,List<T>> |
partitionByToEntry(Predicate<? super T> predicate) |
abstract <A,D> EntryStream<Boolean,D> |
partitionByToEntry(Predicate<? super T> predicate,
Collector<? super T,A,D> downstream) |
abstract Map<Boolean,List<T>> |
partitionTo(Predicate<? super T> predicate) |
abstract <A,D> Map<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 u.Optional<Map<Percentage,T>> |
percentiles(Comparator<? super T> comparator) |
abstract Stream<List<T>> |
permutations()
Stream.of(1, 2, 3).permutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[3, 1, 2]
[3, 2, 1]
[2, 3, 1]
[2, 1, 3]
|
abstract long |
persist(Connection conn,
String insertSQL,
int batchSize,
int batchInterval,
Throwables.BiConsumer<? super PreparedStatement,? super T,SQLException> stmtSetter) |
abstract long |
persist(File file) |
abstract long |
persist(PreparedStatement stmt,
int batchSize,
int batchInterval,
Throwables.BiConsumer<? super PreparedStatement,? super T,SQLException> stmtSetter) |
abstract long |
persist(Throwables.Function<? super T,String,IOException> toLine,
File file) |
abstract long |
persist(Throwables.Function<? super T,String,IOException> toLine,
OutputStream os) |
abstract long |
persist(Throwables.Function<? super T,String,IOException> toLine,
String header,
String tail,
Writer writer) |
abstract long |
persist(Throwables.Function<? super T,String,IOException> toLine,
Writer writer) |
abstract Stream<T> |
prepend(Collection<? extends T> c) |
Stream<T> |
prepend(T... a) |
void |
println() |
abstract Stream<T> |
queued()
Returns a new Stream with elements from a temporary queue which is filled by reading the elements from this Stream asynchronously.
|
abstract Stream<T> |
queued(int queueSize)
Returns a new Stream with elements from a temporary queue which is filled by reading the elements from this Stream asynchronously.
|
static Stream<Integer> |
range(int startInclusive,
int endExclusive) |
static Stream<Integer> |
range(int startInclusive,
int endExclusive,
int by) |
static Stream<Long> |
range(long startInclusive,
long endExclusive) |
static Stream<Long> |
range(long startInclusive,
long endExclusive,
long by) |
static Stream<Integer> |
rangeClosed(int startInclusive,
int endInclusive) |
static Stream<Integer> |
rangeClosed(int startInclusive,
int endInclusive,
int by) |
static Stream<Long> |
rangeClosed(long startInclusive,
long endInclusive) |
static Stream<Long> |
rangeClosed(long startInclusive,
long endInclusive,
long by) |
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 u.Optional<T> |
reduce(BinaryOperator<T> accumulator) |
abstract T |
reduce(T identity,
BinaryOperator<T> accumulator) |
abstract <U> U |
reduce(U identity,
BiFunction<U,? super T,U> accumulator,
BinaryOperator<U> combiner) |
static <T> Stream<T> |
repeat(T element,
long n) |
abstract <K,R> Stream<R> |
rightJoin(Collection<? extends T> b,
Function<? super T,? extends K> keyMapper,
BiFunction<? super T,? super T,R> func)
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(Collection<? extends 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,K> Stream<Pair<T,U>> |
rightJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> 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 <U,K,R> Stream<R> |
rightJoin(Collection<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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,K,R> Stream<R> |
rightJoin(Stream<? extends U> b,
Function<? super T,? extends K> leftKeyMapper,
Function<? super U,? extends K> rightKeyMapper,
BiFunction<? super T,? super U,R> func)
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<List<T>> |
rollup() |
static <T> Stream<T> |
rows(Class<T> targetClass,
ResultSet resultSet)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static Stream<Object[]> |
rows(ResultSet resultSet)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static <T> Stream<T> |
rows(ResultSet resultSet,
int columnIndex)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static <T> Stream<T> |
rows(ResultSet resultSet,
String columnName)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static <T> Stream<T> |
rows(ResultSet resultSet,
Throwables.BiFunction<ResultSet,List<String>,T,SQLException> rowMapper)
It's user's responsibility to close the input
resultSet after the stream is finished. |
static <T> Stream<T> |
rows(ResultSet resultSet,
Throwables.Function<ResultSet,T,SQLException> rowMapper)
It's user's responsibility to close the input
resultSet after the stream is finished. |
abstract Stream<T> |
scan(BiFunction<? super T,? super T,T> accumulator)
Returns a
Stream produced by iterative application of a accumulation function
to an initial element init and next element of the current stream. |
abstract <U> Stream<U> |
scan(U init,
BiFunction<U,? super T,U> accumulator)
Returns a
Stream produced by iterative application of a accumulation function
to an initial element init and next element of the current stream. |
abstract <U> Stream<U> |
scan(U init,
BiFunction<U,? super T,U> accumulator,
boolean initIncluded) |
<U> Stream<U> |
select(Class<U> targetType)
Select the elements belong to the specified
targetType (including its subtype). |
S |
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<T> |
skipUntil(Predicate<? super T> predicate) |
Stream<S> |
sliding(int windowSize) |
abstract <A,R> Stream<R> |
sliding(int windowSize,
Collector<? super T,A,R> collector) |
abstract <A,R> Stream<R> |
sliding(int windowSize,
int increment,
Collector<? super T,A,R> collector) |
abstract <C extends Collection<T>> |
sliding(int windowSize,
IntFunction<? extends C> collectionSupplier) |
abstract <C extends Collection<T>> |
sliding(int windowSize,
int increment,
IntFunction<? extends 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(Comparator<? super T> comparator) |
abstract Stream<T> |
sortedBy(Function<? super T,? extends Comparable> keyMapper) |
abstract Stream<T> |
sortedByDouble(ToDoubleFunction<? super T> keyMapper) |
abstract Stream<T> |
sortedByInt(ToIntFunction<? super T> keyMapper) |
abstract Stream<T> |
sortedByLong(ToLongFunction<? super T> keyMapper) |
abstract <A,R> Stream<R> |
split(int chunkSize,
Collector<? super T,A,R> collector) |
abstract <C extends Collection<T>> |
split(int chunkSize,
IntFunction<? extends C> collectionSupplier)
Returns Stream of Stream with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
|
abstract <A,R> Stream<R> |
split(Predicate<? super T> predicate,
Collector<? super T,A,R> collector) |
abstract <C extends Collection<T>> |
split(Predicate<? super T> predicate,
Supplier<? extends C> collectionSupplier) |
abstract <A,R> Stream<R> |
splitAt(int where,
Collector<? super T,A,R> collector) |
abstract <A,R> Stream<R> |
splitBy(Predicate<? super T> where,
Collector<? super T,A,R> collector) |
abstract Stream<Set<T>> |
splitToSet(int chunkSize)
Returns Stream of Stream with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
|
abstract Stream<Set<T>> |
splitToSet(Predicate<? super T> predicate) |
abstract double |
sumDouble(ToDoubleFunction<? super T> mapper) |
abstract long |
sumInt(ToIntFunction<? super T> mapper) |
abstract long |
sumLong(ToLongFunction<? super T> mapper) |
abstract <A> A[] |
toArray(IntFunction<A[]> generator) |
abstract <R,CC extends Collection<T>,E extends Exception> |
toCollectionAndThen(Supplier<? extends CC> supplier,
Throwables.Function<? super CC,R,E> func) |
abstract DataSet |
toDataSet()
The first row will be used as column names if its type is array or list,
or obtain the column names from first row if its type is entity or map.
|
abstract DataSet |
toDataSet(List<String> columnNames)
If the specified
columnNames is null or empty, the first row will be used as column names if its type is array or list,
or obtain the column names from first row if its type is entity or map. |
ImmutableList<T> |
toImmutableList() |
<K,V> ImmutableMap<K,V> |
toImmutableMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
<K,V> ImmutableMap<K,V> |
toImmutableMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction) |
ImmutableSet<T> |
toImmutableSet() |
abstract Stream<T> |
toJdkStream()
Remember to close this Stream after the iteration is done, if needed.
|
abstract <R,E extends Exception> |
toListAndThen(Throwables.Function<? super List<T>,R,E> func) |
abstract <K,A,D> Map<K,D> |
toMap(Function<? super T,? extends K> keyMapper,
Collector<? super T,A,D> downstream) |
abstract <K,A,D,M extends Map<K,D>> |
toMap(Function<? super T,? extends K> keyMapper,
Collector<? super T,A,D> downstream,
Supplier<? extends M> mapFactory) |
abstract <K,V> Map<K,V> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
abstract <K,V> Map<K,V> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction) |
abstract <K,V,M extends Map<K,V>> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
BinaryOperator<V> mergeFunction,
Supplier<? extends M> mapFactory) |
abstract <K,V,A,D> Map<K,D> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Collector<? super V,A,D> downstream) |
abstract <K,V,A,D,M extends Map<K,D>> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Collector<? super V,A,D> downstream,
Supplier<? extends M> mapFactory) |
abstract <K,V,M extends Map<K,V>> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Supplier<? extends M> mapFactory) |
abstract <K> ListMultimap<K,T> |
toMultimap(Function<? super T,? extends K> keyMapper) |
abstract <K,V> ListMultimap<K,V> |
toMultimap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
abstract <K,V,C extends Collection<V>,M extends Multimap<K,V,C>> |
toMultimap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Supplier<? extends M> mapFactory) |
abstract <K,V extends Collection<T>,M extends Multimap<K,T,V>> |
toMultimap(Function<? super T,? extends K> keyMapper,
Supplier<? extends M> mapFactory) |
abstract Stream<T> |
top(int n)
This method only run sequentially, even in parallel stream. |
abstract Stream<T> |
top(int n,
Comparator<? super T> comparator)
This method only run sequentially, even in parallel stream. |
abstract <R,E extends Exception> |
toSetAndThen(Throwables.Function<? super Set<T>,R,E> func) |
abstract Stream<Stream<T>> |
window(Duration duration)
Split this stream by the specified duration.
|
abstract <A,R> Stream<R> |
window(Duration duration,
Collector<? super T,A,R> collector) |
abstract Stream<Stream<T>> |
window(Duration duration,
long incrementInMillis) |
abstract <A,R> Stream<R> |
window(Duration duration,
long incrementInMillis,
Collector<? super T,A,R> collector) |
abstract Stream<Stream<T>> |
window(Duration duration,
long incrementInMillis,
LongSupplier startTime) |
abstract <A,R> Stream<R> |
window(Duration duration,
long incrementInMillis,
LongSupplier startTime,
Collector<? super T,A,R> collector) |
abstract <C extends Collection<T>> |
window(Duration duration,
long incrementInMillis,
LongSupplier startTime,
Supplier<? extends C> collectionSupplier) |
abstract Stream<Stream<T>> |
window(Duration duration,
LongSupplier startTime) |
abstract <C extends Collection<T>> |
window(Duration duration,
long incrementInMillis,
Supplier<? extends C> collectionSupplier) |
abstract <A,R> Stream<R> |
window(Duration duration,
LongSupplier startTime,
Collector<? super T,A,R> collector) |
abstract <C extends Collection<T>> |
window(Duration duration,
LongSupplier startTime,
Supplier<? extends C> collectionSupplier) |
abstract <C extends Collection<T>> |
window(Duration duration,
Supplier<? extends C> collectionSupplier) |
abstract Stream<Stream<T>> |
window(int maxWindowSize,
Duration maxDuration) |
abstract <A,R> Stream<R> |
window(int maxWindowSize,
Duration maxDuration,
Collector<? super T,A,R> collector) |
abstract Stream<Stream<T>> |
window(int maxWindowSize,
Duration maxDuration,
LongSupplier startTime) |
abstract <A,R> Stream<R> |
window(int maxWindowSize,
Duration maxDuration,
LongSupplier startTime,
Collector<? super T,A,R> collector)
Split this stream at where
maxWindowSize or maxDuration reaches first. |
abstract <C extends Collection<T>> |
window(int maxWindowSize,
Duration maxDuration,
LongSupplier startTime,
Supplier<? extends C> collectionSupplier)
Split this stream at where
maxWindowSize or maxDuration reaches first. |
abstract <C extends Collection<T>> |
window(int maxWindowSize,
Duration maxDuration,
Supplier<? extends C> collectionSupplier) |
abstract Stream<List<T>> |
windowToList(Duration duration) |
abstract Stream<List<T>> |
windowToList(Duration duration,
long incrementInMillis) |
abstract Stream<Set<T>> |
windowToSet(Duration duration) |
abstract Stream<Set<T>> |
windowToSet(Duration duration,
long incrementInMillis) |
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(Collection<? extends A> a,
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(Collection<? extends A> a,
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(Collection<? extends A> a,
Collection<? extends B> b,
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(Collection<? extends A> a,
Collection<? extends B> b,
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(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(Collection<? extends ByteStream> c,
ByteNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends CharStream> c,
char[] valuesForNone,
CharNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends CharStream> c,
CharNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends DoubleStream> c,
double[] valuesForNone,
DoubleNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends DoubleStream> c,
DoubleNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends FloatStream> c,
float[] valuesForNone,
FloatNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends FloatStream> c,
FloatNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends IntStream> c,
int[] valuesForNone,
IntNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends IntStream> c,
IntNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends LongStream> c,
long[] valuesForNone,
LongNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends LongStream> c,
LongNFunction<R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <R> Stream<R> |
zip(Collection<? extends ShortStream> c,
short[] valuesForNone,
ShortNFunction<R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static <R> Stream<R> |
zip(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(Collection<? extends Stream<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static <T,R> Stream<R> |
zip(Collection<? extends Stream<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction)
Zip together the iterators until all of them runs out of values.
|
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(Iterator<? extends A> a,
Iterator<? extends B> b,
A valueForNoneA,
B valueForNoneB,
BiFunction<? super A,? super B,R> zipFunction)
Zip together the "a" and "b" iterators until all of them runs out of values.
|
static <A,B,R> Stream<R> |
zip(Iterator<? extends A> a,
Iterator<? extends B> b,
BiFunction<? super A,? super B,R> zipFunction)
Zip together the "a" and "b" iterators until one of them runs out of values.
|
static <A,B,C,R> Stream<R> |
zip(Iterator<? extends A> a,
Iterator<? extends B> b,
Iterator<? extends C> c,
A valueForNoneA,
B valueForNoneB,
C valueForNoneC,
TriFunction<? super A,? super B,? super C,R> zipFunction)
Zip together the "a", "b" and "c" iterators until all of them runs out of values.
|
static <A,B,C,R> Stream<R> |
zip(Iterator<? extends A> a,
Iterator<? extends B> b,
Iterator<? extends C> c,
TriFunction<? super A,? super B,? super C,R> zipFunction)
Zip together the "a", "b" and "c" iterators until one of them runs out of values.
|
static <T,R> Stream<R> |
zip(List<? extends Collection<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
zip(List<? extends Collection<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super List<? extends T>,R> zipFunction) |
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(Collection<? extends Iterator<? extends T>> c,
Function<? super List<? extends T>,R> zipFunction) |
static <T,R> Stream<R> |
zipp(Collection<? extends Iterator<? extends T>> c,
List<? extends T> valuesForNone,
Function<? super 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
acceptIfNotEmpty, append, appendIfEmpty, applyIfNotEmpty, count, difference, distinct, dropWhile, dropWhile, filter, filter, first, indexed, intersection, join, last, limit, onClose, onlyOne, peek, percentiles, prepend, removeIf, removeIf, reversed, reverseSorted, rotated, shuffled, skip, skip, sliding, slidingToList, sorted, split, split, splitAt, splitBy, splitToList, splitToList, step, symmetricDifference, takeWhile, toArray, toCollection, toList, toLongMultiset, toLongMultiset, toMultiset, toMultiset, toSet
@SequentialOnly @IntermediateOp public <U> Stream<U> select(Class<U> targetType)
targetType
(including its subtype).U
- targetType
- @SequentialOnly @IntermediateOp @Beta public Stream<T> skipUntil(Predicate<? super T> predicate)
predicate
- @ParallelSupported @IntermediateOp public abstract <R> Stream<R> map(Function<? super T,? extends R> mapper)
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper)
@ParallelSupported @IntermediateOp 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 @IntermediateOp public abstract <R> Stream<R> slidingMap(BiFunction<? super T,? super T,R> mapper, int increment, boolean ignoreNotPaired)
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper)
@ParallelSupported @IntermediateOp 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 @IntermediateOp public abstract <R> Stream<R> slidingMap(TriFunction<? super T,? super T,? super T,R> mapper, int increment, boolean ignoreNotPaired)
@SequentialOnly @IntermediateOp 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 @IntermediateOp public abstract Stream<T> mapFirst(Function<? super T,? extends T> mapperForFirst)
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapFirstOrElse(Function<? super T,? extends R> mapperForFirst, Function<? super T,? extends R> mapperForElse)
@ParallelSupported @IntermediateOp public abstract Stream<T> mapLast(Function<? super T,? extends T> mapperForLast)
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> mapLastOrElse(Function<? super T,? extends R> mapperForLast, Function<? super T,? extends R> mapperForElse)
@ParallelSupported @IntermediateOp public abstract CharStream mapToChar(ToCharFunction<? super T> mapper)
@ParallelSupported @IntermediateOp public abstract ByteStream mapToByte(ToByteFunction<? super T> mapper)
@ParallelSupported @IntermediateOp public abstract ShortStream mapToShort(ToShortFunction<? super T> mapper)
@ParallelSupported @IntermediateOp public abstract IntStream mapToInt(ToIntFunction<? super T> mapper)
@ParallelSupported @IntermediateOp public abstract LongStream mapToLong(ToLongFunction<? super T> mapper)
@ParallelSupported @IntermediateOp public abstract FloatStream mapToFloat(ToFloatFunction<? super T> mapper)
@ParallelSupported @IntermediateOp public abstract DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper)
@ParallelSupported @IntermediateOp public abstract <K,V> EntryStream<K,V> mapToEntry(Function<? super T,? extends Map.Entry<? extends K,? extends V>> mapper)
@ParallelSupported @IntermediateOp public abstract <K,V> EntryStream<K,V> mapToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> flattMap(Function<? super T,? extends Collection<? extends R>> mapper)
@ParallelSupported @IntermediateOp public abstract <R> Stream<R> flatMapp(Function<? super T,R[]> mapper)
@ParallelSupported @IntermediateOp public abstract CharStream flatMapToChar(Function<? super T,? extends CharStream> mapper)
@ParallelSupported @IntermediateOp public abstract CharStream flattMapToChar(Function<? super T,char[]> mapper)
@ParallelSupported @IntermediateOp public abstract ByteStream flatMapToByte(Function<? super T,? extends ByteStream> mapper)
@ParallelSupported @IntermediateOp public abstract ByteStream flattMapToByte(Function<? super T,byte[]> mapper)
@ParallelSupported @IntermediateOp public abstract ShortStream flatMapToShort(Function<? super T,? extends ShortStream> mapper)
@ParallelSupported @IntermediateOp public abstract ShortStream flattMapToShort(Function<? super T,short[]> mapper)
@ParallelSupported @IntermediateOp public abstract IntStream flatMapToInt(Function<? super T,? extends IntStream> mapper)
@ParallelSupported @IntermediateOp public abstract IntStream flattMapToInt(Function<? super T,int[]> mapper)
@ParallelSupported @IntermediateOp public abstract LongStream flatMapToLong(Function<? super T,? extends LongStream> mapper)
@ParallelSupported @IntermediateOp public abstract LongStream flattMapToLong(Function<? super T,long[]> mapper)
@ParallelSupported @IntermediateOp public abstract FloatStream flatMapToFloat(Function<? super T,? extends FloatStream> mapper)
@ParallelSupported @IntermediateOp public abstract FloatStream flattMapToFloat(Function<? super T,float[]> mapper)
@ParallelSupported @IntermediateOp public abstract DoubleStream flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
@ParallelSupported @IntermediateOp public abstract DoubleStream flattMapToDouble(Function<? super T,double[]> mapper)
@ParallelSupported @IntermediateOp public abstract <K,V> EntryStream<K,V> flatMapToEntry(Function<? super T,? extends Stream<? extends Map.Entry<? extends K,? extends V>>> mapper)
@ParallelSupported @IntermediateOp public abstract <K,V> EntryStream<K,V> flattMapToEntry(Function<? super T,? extends Map<? extends K,? extends V>> mapper)
@ParallelSupported @IntermediateOp public abstract <K,V> EntryStream<K,V> flatMappToEntry(Function<? super T,? extends EntryStream<? extends K,? extends V>> mapper)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> Stream<Map.Entry<K,List<T>>> groupBy(Function<? super T,? extends K> keyMapper)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> Stream<Map.Entry<K,List<T>>> groupBy(Function<? super T,? extends K> keyMapper, Supplier<? extends Map<K,List<T>>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> Stream<Map.Entry<K,List<V>>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
keyMapper
- valueMapper
- Collectors.toMultimap(Function, Function)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> Stream<Map.Entry<K,List<V>>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends Map<K,List<V>>> mapFactory)
keyMapper
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,A,D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,A,D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V,A,D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V,A,D> Stream<Map.Entry<K,D>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> Stream<Map.Entry<K,V>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> Stream<Map.Entry<K,V>> groupBy(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K,V>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<Map.Entry<Boolean,List<T>>> partitionBy(Predicate<? super T> predicate)
predicate
- Collectors.partitioningBy(Predicate)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <A,D> Stream<Map.Entry<Boolean,D>> partitionBy(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
predicate
- downstream
- Collectors.partitioningBy(Predicate, Collector)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<Map.Entry<K,Integer>> countBy(Function<? super T,? extends K> keyMapper)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> EntryStream<K,List<T>> groupByToEntry(Function<? super T,? extends K> keyMapper)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K> EntryStream<K,List<T>> groupByToEntry(Function<? super T,? extends K> keyMapper, Supplier<? extends Map<K,List<T>>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> EntryStream<K,List<V>> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
keyMapper
- valueMapper
- Collectors.toMultimap(Function, Function)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> EntryStream<K,List<V>> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends Map<K,List<V>>> mapFactory)
keyMapper
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V,A,D> EntryStream<K,D> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream, Supplier<? extends Map<K,D>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> EntryStream<K,V> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <K,V> EntryStream<K,V> groupByToEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends Map<K,V>> mapFactory)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract EntryStream<Boolean,List<T>> partitionByToEntry(Predicate<? super T> predicate)
predicate
- Collectors.partitioningBy(Predicate)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract <A,D> EntryStream<Boolean,D> partitionByToEntry(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
predicate
- downstream
- Collectors.partitioningBy(Predicate, Collector)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> EntryStream<K,Integer> countByToEntry(Function<? super T,? extends K> keyMapper)
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> collapse(BiPredicate<? super T,? super T> collapsible)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> collapse(BiPredicate<? super T,? super T> collapsible, Supplier<? extends C> supplier)
@SequentialOnly @IntermediateOp 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 @IntermediateOp public abstract <U> Stream<U> collapse(BiPredicate<? super T,? super T> collapsible, U init, BiFunction<U,? super T,U> op)
@SequentialOnly @IntermediateOp public abstract <R> Stream<R> collapse(BiPredicate<? super T,? super T> collapsible, Supplier<R> supplier, BiConsumer<? super R,? super T> accumulator)
@SequentialOnly @IntermediateOp 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 @IntermediateOp 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 init
and next element of the current stream.
Produces a Stream
consisting of init
, acc(init, value1)
,
acc(acc(init, value1), value2)
, etc.
This is an intermediate operation.
Example:
Stream.of(new Integer[0]).scan((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 @IntermediateOp public abstract <U> Stream<U> scan(U init, BiFunction<U,? super T,U> accumulator)
Stream
produced by iterative application of a accumulation function
to an initial element init
and next element of the current stream.
Produces a Stream
consisting of init
, acc(init, value1)
,
acc(acc(init, value1), value2)
, etc.
This is an intermediate operation.
Example:
Stream.of(new Integer[0]).scan(10, (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]
init
- the initial value. it's only used once by accumulator
to calculate the fist element in the returned stream.
It will be ignored if this stream is empty and won't be the first element of the returned stream.accumulator
- the accumulation function@SequentialOnly @IntermediateOp public abstract <U> Stream<U> scan(U init, BiFunction<U,? super T,U> accumulator, boolean initIncluded)
init
- accumulator
- initIncluded
- @SequentialOnly @IntermediateOp public abstract Stream<Set<T>> splitToSet(int chunkSize)
chunkSize
- the desired size of each sub sequence (the last may be smaller).@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> split(int chunkSize, IntFunction<? extends C> collectionSupplier)
chunkSize
- the desired size of each sub sequence (the last may be smaller).collectionSupplier
- @SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> split(int chunkSize, Collector<? super T,A,R> collector)
chunkSize
- the desired size of each sub sequence (the last may be smaller).collector
- @SequentialOnly @IntermediateOp public abstract Stream<Set<T>> splitToSet(Predicate<? super T> predicate)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> split(Predicate<? super T> predicate, Supplier<? extends C> collectionSupplier)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> split(Predicate<? super T> predicate, Collector<? super T,A,R> collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> splitAt(int where, Collector<? super T,A,R> collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> splitBy(Predicate<? super T> where, Collector<? super T,A,R> collector)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> sliding(int windowSize, IntFunction<? extends C> collectionSupplier)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> sliding(int windowSize, int increment, IntFunction<? extends C> collectionSupplier)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> sliding(int windowSize, Collector<? super T,A,R> collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> sliding(int windowSize, int increment, Collector<? super T,A,R> collector)
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> window(Duration duration)
duration
- Fn.window(Duration, LongSupplier)
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> window(Duration duration, LongSupplier startTime)
duration
- startTime
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> windowToList(Duration duration)
duration
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<Set<T>> windowToSet(Duration duration)
duration
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> window(Duration duration, Supplier<? extends C> collectionSupplier)
duration
- collectionSupplier
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> window(Duration duration, LongSupplier startTime, Supplier<? extends C> collectionSupplier)
duration
- startTime
- collectionSupplier
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> window(Duration duration, Collector<? super T,A,R> collector)
duration
- collector
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> window(Duration duration, LongSupplier startTime, Collector<? super T,A,R> collector)
duration
- startTime
- collector
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> window(Duration duration, long incrementInMillis)
duration
- incrementInMillis
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> window(Duration duration, long incrementInMillis, LongSupplier startTime)
duration
- incrementInMillis
- startTime
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> windowToList(Duration duration, long incrementInMillis)
duration
- incrementInMillis
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<Set<T>> windowToSet(Duration duration, long incrementInMillis)
duration
- incrementInMillis
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> window(Duration duration, long incrementInMillis, Supplier<? extends C> collectionSupplier)
duration
- incrementInMillis
- collectionSupplier
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> window(Duration duration, long incrementInMillis, LongSupplier startTime, Supplier<? extends C> collectionSupplier)
duration
- incrementInMillis
- startTime
- collectionSupplier
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> window(Duration duration, long incrementInMillis, Collector<? super T,A,R> collector)
duration
- incrementInMillis
- collector
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> window(Duration duration, long incrementInMillis, LongSupplier startTime, Collector<? super T,A,R> collector)
duration
- incrementInMillis
- startTime
- collector
- window(Duration)
,
Fn.window(Duration, LongSupplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> window(int maxWindowSize, Duration maxDuration)
maxWindowSize
- maxDuration
- window(int, Duration, LongSupplier, Supplier)
,
Fn.window(int, Duration, LongSupplier, Supplier)
@SequentialOnly @IntermediateOp public abstract Stream<Stream<T>> window(int maxWindowSize, Duration maxDuration, LongSupplier startTime)
maxWindowSize
- maxDuration
- startTime
- window(int, Duration, LongSupplier, Supplier)
,
Fn.window(int, Duration, LongSupplier, Supplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> window(int maxWindowSize, Duration maxDuration, Supplier<? extends C> collectionSupplier)
maxWindowSize
- maxDuration
- collectionSupplier
- window(int, Duration, LongSupplier, Supplier)
,
Fn.window(int, Duration, LongSupplier, Supplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <C extends Collection<T>> Stream<C> window(int maxWindowSize, Duration maxDuration, LongSupplier startTime, Supplier<? extends C> collectionSupplier)
maxWindowSize
or maxDuration
reaches first.maxWindowSize
- maxDuration
- startTime
- collectionSupplier
- window(int, Duration, LongSupplier, Supplier)
,
Fn.window(int, Duration, LongSupplier, Supplier)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> window(int maxWindowSize, Duration maxDuration, Collector<? super T,A,R> collector)
maxWindowSize
- maxDuration
- collector
- window(int, Duration, LongSupplier, Collector)
,
Fn.window(int, Duration, LongSupplier, Collector)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract <A,R> Stream<R> window(int maxWindowSize, Duration maxDuration, LongSupplier startTime, Collector<? super T,A,R> collector)
maxWindowSize
or maxDuration
reaches first.maxWindowSize
- maxDuration
- startTime
- collector
- window(Duration, long, LongSupplier, Collector)
,
Fn.window(int, Duration, LongSupplier, Collector)
,
sliding(int, int, Collector)
@SequentialOnly @IntermediateOp public abstract Stream<T> intersperse(T delimiter)
Stream.of(1).intersperse(9) --> [1]
Stream.of(1, 2, 3).intersperse(9) --> [1, 9, 2, 9, 3]
delimiter
- @ParallelSupported @IntermediateOp public Stream<T> distinct(Predicate<? super Long> occurrencesFilter)
occurrencesFilter
- @ParallelSupported @IntermediateOp public abstract Stream<T> distinctBy(Function<? super T,?> keyMapper)
keyMapper
keyMapper
- don't change value of the input parameter.@ParallelSupported @IntermediateOp public <K> Stream<T> distinctBy(Function<? super T,K> keyMapper, Predicate<? super Long> occurrencesFilter)
keyMapper
- occurrencesFilter
- groupBy(Function, Collector)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public <K> Stream<T> distinctBy(Function<? super T,K> keyMapper, BinaryOperator<T> mergeFunction)
keyMapper
- mergeFunction
- groupBy(Function, Function, BinaryOperator)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sorted(Comparator<? super T> comparator)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedBy(Function<? super T,? extends Comparable> keyMapper)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByInt(ToIntFunction<? super T> keyMapper)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByLong(ToLongFunction<? super T> keyMapper)
@ParallelSupported @IntermediateOp @TerminalOpTriggered public abstract Stream<T> sortedByDouble(ToDoubleFunction<? super T> keyMapper)
@SequentialOnly @IntermediateOp public abstract Stream<T> top(int n)
n
- @SequentialOnly @IntermediateOp public abstract Stream<T> top(int n, Comparator<? super T> comparator)
n
- comparator
- @SequentialOnly @IntermediateOp 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
elements and the Stream will be closed after that, if a terminal operation is triggered.n
- @SequentialOnly @IntermediateOp 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 @IntermediateOp public abstract Stream<T> skipNull()
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEach(Throwables.Consumer<? super T,E> action) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachIndexed(Throwables.IndexedConsumer<? super T,E> action) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception,E2 extends Exception> void forEach(Throwables.Consumer<? super T,E> action, Throwables.Runnable<E2> onComplete) throws E extends Exception, E2 extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <U,E extends Exception,E2 extends Exception> void forEach(Throwables.Function<? super T,? extends Collection<? extends U>,E> flatMapper, Throwables.BiConsumer<? super T,? super U,E2> action) throws E extends Exception, E2 extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <T2,T3,E extends Exception,E2 extends Exception,E3 extends Exception> void forEach(Throwables.Function<? super T,? extends Collection<T2>,E> flatMapper, Throwables.Function<? super T2,? extends Collection<T3>,E2> flatMapper2, Throwables.TriConsumer<? super T,? super T2,? super T3,E3> action) throws E extends Exception, E2 extends Exception, E3 extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachPair(Throwables.BiConsumer<? super T,? super T,E> action) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachPair(Throwables.BiConsumer<? super T,? super T,E> action, int increment) throws E extends Exception
windowSize = 2
and the specified increment
, then consume
by the specified mapper
.mapper
- increment
- E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachTriple(Throwables.TriConsumer<? super T,? super T,? super T,E> action) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> void forEachTriple(Throwables.TriConsumer<? super T,? super T,? super T,E> action, int increment) throws E extends Exception
windowSize = 3
and the specified increment
, then consume
by the specified mapper
.mapper
- increment
- E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean anyMatch(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean allMatch(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean noneMatch(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> boolean nMatch(long atLeast, long atMost, Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findFirst(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findLast(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
stream.reversed().findFirst(predicate)
for better performance if possible.E
- predicate
- E
E extends Exception
@SequentialOnly @TerminalOp public abstract <E extends Exception,E2 extends Exception> u.Optional<T> findFirstOrLast(Throwables.Predicate<? super T,E> predicateForFirst, Throwables.Predicate<? super T,E2> predicateForLast) throws E extends Exception, E2 extends Exception
E extends Exception
@SequentialOnly @TerminalOp public abstract <U,E extends Exception,E2 extends Exception> u.Optional<T> findFirstOrLast(U init, Throwables.BiPredicate<? super T,? super U,E> predicateForFirst, Throwables.BiPredicate<? super T,? super U,E2> predicateForLast) throws E extends Exception, E2 extends Exception
init
- predicateForFirst
- predicateForLast
- E extends Exception
@SequentialOnly @TerminalOp public abstract <U,E extends Exception,E2 extends Exception> u.Optional<T> findFirstOrLast(Function<? super T,U> preFunc, Throwables.BiPredicate<? super T,? super U,E> predicateForFirst, Throwables.BiPredicate<? super T,? super U,E2> predicateForLast) throws E extends Exception, E2 extends Exception
preFunc
- predicateForFirst
- predicateForLast
- E extends Exception
@ParallelSupported @TerminalOp public abstract <E extends Exception> u.Optional<T> findAny(Throwables.Predicate<? super T,E> predicate) throws E extends Exception
E extends Exception
@SequentialOnly @TerminalOp public abstract boolean containsAll(T... a)
@SequentialOnly @TerminalOp public abstract boolean containsAll(Collection<? extends T> c)
@SequentialOnly @TerminalOp public abstract boolean containsAny(T... a)
@SequentialOnly @TerminalOp public abstract boolean containsAny(Collection<? extends T> c)
@SequentialOnly @TerminalOp public abstract <A> A[] toArray(IntFunction<A[]> generator)
@ParallelSupported @TerminalOp public <K,V> ImmutableMap<K,V> toImmutableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
keyMapper
- valueMapper
- Collectors.toMap(Function, Function)
@ParallelSupported @TerminalOp public <K,V> ImmutableMap<K,V> toImmutableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
keyMapper
- valueMapper
- mergeFunction
- Collectors.toMap(Function, Function)
@ParallelSupported @TerminalOp public abstract <K,V> Map<K,V> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
keyMapper
- valueMapper
- Collectors.toMap(Function, Function)
@ParallelSupported @TerminalOp public abstract <K,V> Map<K,V> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
keyMapper
- valueMapper
- mergeFunction
- Collectors.toMap(Function, Function, BinaryOperator)
@ParallelSupported @TerminalOp public abstract <K,V,M extends Map<K,V>> M toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends M> mapFactory)
keyMapper
- valueMapper
- mapFactory
- Collectors.toMap(Function, Function, Supplier)
@ParallelSupported @TerminalOp public abstract <K,V,M extends Map<K,V>> M toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory)
keyMapper
- valueMapper
- mergeFunction
- mapFactory
- Collectors.toMap(Function, Function, BinaryOperator, Supplier)
@ParallelSupported @TerminalOp public abstract <K,A,D> Map<K,D> toMap(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream)
keyMapper
- downstream
- Collectors.groupingBy(Function, Collector)
@ParallelSupported @TerminalOp public abstract <K,A,D,M extends Map<K,D>> M toMap(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream, Supplier<? extends M> mapFactory)
keyMapper
- downstream
- mapFactory
- Collectors.groupingBy(Function, Collector, Supplier)
@ParallelSupported @TerminalOp public abstract <K,V,A,D> Map<K,D> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream)
keyMapper
- valueMapper
- downstream
- Collectors.groupingBy(Function, Collector)
@ParallelSupported @TerminalOp public abstract <K,V,A,D,M extends Map<K,D>> M toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Collector<? super V,A,D> downstream, Supplier<? extends M> mapFactory)
keyMapper
- valueMapper
- downstream
- mapFactory
- Collectors.groupingBy(Function, Collector, Supplier)
@ParallelSupported @TerminalOp public abstract <K> Map<K,List<T>> groupTo(Function<? super T,? extends K> keyMapper)
keyMapper
- Collectors.groupingBy(Function)
@ParallelSupported @TerminalOp public abstract <K,M extends Map<K,List<T>>> M groupTo(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
keyMapper
- mapFactory
- Collectors.groupingBy(Function, Supplier)
@ParallelSupported @TerminalOp public abstract <K,V> Map<K,List<V>> groupTo(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
@ParallelSupported @TerminalOp public abstract <K,V,M extends Map<K,List<V>>> M groupTo(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends M> mapFactory)
keyMapper
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
@ParallelSupported @TerminalOp public abstract Map<Boolean,List<T>> partitionTo(Predicate<? super T> predicate)
predicate
- Collectors.partitioningBy(Predicate)
@ParallelSupported @TerminalOp public abstract <A,D> Map<Boolean,D> partitionTo(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
predicate
- downstream
- Collectors.partitioningBy(Predicate, Collector)
@ParallelSupported @TerminalOp public abstract <K> ListMultimap<K,T> toMultimap(Function<? super T,? extends K> keyMapper)
keyMapper
- Collectors.toMultimap(Function, Function)
@ParallelSupported @TerminalOp public abstract <K,V extends Collection<T>,M extends Multimap<K,T,V>> M toMultimap(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
keyMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
@ParallelSupported @TerminalOp public abstract <K,V> ListMultimap<K,V> toMultimap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
keyMapper
- valueMapper
- Collectors.toMultimap(Function, Function)
@ParallelSupported @TerminalOp public abstract <K,V,C extends Collection<V>,M extends Multimap<K,V,C>> M toMultimap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends M> mapFactory)
keyMapper
- valueMapper
- mapFactory
- Collectors.toMultimap(Function, Function, Supplier)
@SequentialOnly @TerminalOp public abstract DataSet toDataSet()
E
N#newDataSet(Collection)}
@SequentialOnly @TerminalOp public abstract DataSet toDataSet(List<String> columnNames)
columnNames
is null or empty, the first row will be used as column names if its type is array or list,
or obtain the column names from first row if its type is entity or map.columnNames
- E
N#newDataSet(Collection, Collection)}
@ParallelSupported public abstract T reduce(T identity, BinaryOperator<T> accumulator)
@ParallelSupported @TerminalOp public abstract u.Optional<T> reduce(BinaryOperator<T> accumulator)
@ParallelSupported @TerminalOp public abstract <U> U reduce(U identity, BiFunction<U,? super T,U> accumulator, BinaryOperator<U> combiner)
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, BiConsumer<? super R,? super T> accumulator, BiConsumer<R,R> combiner)
@ParallelSupported @TerminalOp public abstract <R> R collect(Supplier<R> supplier, BiConsumer<? super R,? super T> accumulator)
@ParallelSupported @TerminalOp public abstract <R,A> R collect(Collector<? super T,A,R> collector)
@ParallelSupported @TerminalOp public abstract <R,A> R collect(Collector<? super T,A,R> collector)
@ParallelSupported @TerminalOp public abstract <R,A,RR,E extends Exception> RR collectAndThen(Collector<? super T,A,R> downstream, Throwables.Function<? super R,RR,E> func) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract <R,A,RR,E extends Exception> RR collectAndThen(Collector<? super T,A,R> downstream, Throwables.Function<? super R,RR,E> func) throws E extends Exception
E extends Exception
@SequentialOnly @TerminalOp public abstract <R,E extends Exception> R toListAndThen(Throwables.Function<? super List<T>,R,E> func) throws E extends Exception
E extends Exception
@SequentialOnly @TerminalOp public abstract <R,E extends Exception> R toSetAndThen(Throwables.Function<? super Set<T>,R,E> func) throws E extends Exception
E extends Exception
@SequentialOnly @TerminalOp public abstract <R,CC extends Collection<T>,E extends Exception> R toCollectionAndThen(Supplier<? extends CC> supplier, Throwables.Function<? super CC,R,E> func) throws E extends Exception
E extends Exception
@ParallelSupported @TerminalOp public abstract u.Optional<T> min(Comparator<? super T> comparator)
@ParallelSupported @TerminalOp public u.Optional<T> minBy(Function<? super T,? extends Comparable> keyMapper)
@ParallelSupported @TerminalOp public abstract u.Optional<T> max(Comparator<? super T> comparator)
@ParallelSupported @TerminalOp public u.Optional<T> maxBy(Function<? super T,? extends Comparable> keyMapper)
@ParallelSupported @TerminalOp public abstract u.Optional<T> kthLargest(int k, Comparator<? super T> comparator)
k
- comparator
- @ParallelSupported @TerminalOp public abstract long sumInt(ToIntFunction<? super T> mapper)
@ParallelSupported @TerminalOp public abstract long sumLong(ToLongFunction<? super T> mapper)
@ParallelSupported @TerminalOp public abstract double sumDouble(ToDoubleFunction<? super T> mapper)
@ParallelSupported @TerminalOp public abstract u.OptionalDouble averageInt(ToIntFunction<? super T> mapper)
@ParallelSupported @TerminalOp public abstract u.OptionalDouble averageLong(ToLongFunction<? super T> mapper)
@ParallelSupported @TerminalOp public abstract u.OptionalDouble averageDouble(ToDoubleFunction<? super T> mapper)
@SequentialOnly @TerminalOp public abstract u.Optional<Map<Percentage,T>> percentiles(Comparator<? super T> comparator)
@SequentialOnly @TerminalOp public abstract boolean hasDuplicates()
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations()
Stream.of(1, 2, 3).combinations().forEach(Fn.println());
// output
[]
[1]
[2]
[3]
[1, 2]
[1, 3]
[2, 3]
[1, 2, 3]
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> combinations(int len)
Stream.of(1, 2, 3).combinations(2).forEach(Fn.println());
// output
[1, 2]
[1, 3]
[2, 3]
len
- @SequentialOnly @IntermediateOp public abstract Stream<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 @IntermediateOp public abstract Stream<List<T>> permutations()
Stream.of(1, 2, 3).permutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[3, 1, 2]
[3, 2, 1]
[2, 3, 1]
[2, 1, 3]
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> orderedPermutations()
Stream.of(1, 2, 3).orderedPermutations().forEach(Fn.println());
// output
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
@SequentialOnly @IntermediateOp public abstract Stream<List<T>> orderedPermutations(Comparator<? super T> comparator)
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<List<T>> cartesianProduct(Collection<? extends T>... cs)
@SequentialOnly @IntermediateOp public abstract <U> Stream<Pair<T,U>> crossJoin(Collection<? extends U> b)
U
- b
- @SequentialOnly @IntermediateOp public abstract <U,R> Stream<R> crossJoin(Collection<? extends U> b, BiFunction<? super T,? super U,R> func)
U
- R
- b
- func
- @SequentialOnly @IntermediateOp public abstract <U,R> Stream<R> crossJoin(Stream<? extends U> b, BiFunction<? super T,? super U,R> func)
U
- R
- b
- func
- @ParallelSupported @IntermediateOp public abstract <U,K> Stream<Pair<T,U>> innerJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper)
Stream
and m is the size of specified collection b
.U
- K
- b
- leftKeyMapper
- rightKeyMapper
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> innerJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <K,R> Stream<R> innerJoin(Collection<? extends T> b, Function<? super T,? extends K> keyMapper, BiFunction<? super T,? super T,R> func)
Stream
and m is the size of specified collection b
.K
- R
- b
- keyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> innerJoin(Stream<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T,U>> innerJoin(Collection<? extends U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.U
- b
- predicate
- @ParallelSupported @IntermediateOp public abstract <U,K> Stream<Pair<T,U>> fullJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper)
Stream
and m is the size of specified collection b
.U
- K
- b
- leftKeyMapper
- rightKeyMapper
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> fullJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <K,R> Stream<R> fullJoin(Collection<? extends T> b, Function<? super T,? extends K> keyMapper, BiFunction<? super T,? super T,R> func)
Stream
and m is the size of specified collection b
.K
- R
- b
- keyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> fullJoin(Stream<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T,U>> fullJoin(Collection<? extends U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.U
- b
- predicate
- @ParallelSupported @IntermediateOp public abstract <U,K> Stream<Pair<T,U>> leftJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper)
Stream
and m is the size of specified collection b
.U
- K
- b
- leftKeyMapper
- rightKeyMapper
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> leftJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <K,R> Stream<R> leftJoin(Collection<? extends T> b, Function<? super T,? extends K> keyMapper, BiFunction<? super T,? super T,R> func)
Stream
and m is the size of specified collection b
.K
- R
- b
- keyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> leftJoin(Stream<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T,U>> leftJoin(Collection<? extends U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.U
- b
- predicate
- @ParallelSupported @IntermediateOp public abstract <U,K> Stream<Pair<T,U>> rightJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper)
Stream
and m is the size of specified collection b
.U
- K
- b
- leftKeyMapper
- rightKeyMapper
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> rightJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <K,R> Stream<R> rightJoin(Collection<? extends T> b, Function<? super T,? extends K> keyMapper, BiFunction<? super T,? super T,R> func)
Stream
and m is the size of specified collection b
.K
- R
- b
- keyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> rightJoin(Stream<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super U,R> func)
Stream
and m is the size of specified collection b
.U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U> Stream<Pair<T,U>> rightJoin(Collection<? extends U> b, BiPredicate<? super T,? super U> predicate)
Stream
and m is the size of specified collection b
.U
- b
- predicate
- @ParallelSupported @IntermediateOp public abstract <U,K> Stream<Pair<T,List<U>>> groupJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper)
U
- K
- b
- leftKeyMapper
- rightKeyMapper
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> groupJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super List<U>,R> func)
U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- @ParallelSupported @IntermediateOp public abstract <K,R> Stream<R> groupJoin(Collection<? extends T> b, Function<? super T,? extends K> keyMapper, BiFunction<? super T,? super List<T>,R> func)
Stream
and m is the size of specified collection b
.K
- R
- b
- keyMapper
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> groupJoin(Stream<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BiFunction<? super T,? super List<U>,R> func)
U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- @ParallelSupported @IntermediateOp public abstract <U,K> Stream<Pair<T,U>> groupJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BinaryOperator<U> mergeFunction)
U
- K
- b
- leftKeyMapper
- rightKeyMapper
- mergeFunction
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> groupJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BinaryOperator<U> mergeFunction, BiFunction<? super T,? super U,R> func)
U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- mergeFunction
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,R> Stream<R> groupJoin(Stream<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, BinaryOperator<U> mergeFunction, BiFunction<? super T,? super U,R> func)
U
- K
- R
- b
- leftKeyMapper
- rightKeyMapper
- mergeFunction
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,A,D> Stream<Pair<T,D>> groupJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, Collector<? super U,A,D> downstream)
U
- K
- A
- D
- b
- leftKeyMapper
- rightKeyMapper
- downstream
- @ParallelSupported @IntermediateOp public abstract <U,K,A,D,R> Stream<R> groupJoin(Collection<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, Collector<? super U,A,D> downstream, BiFunction<? super T,? super D,R> func)
U
- K
- A
- D
- R
- b
- leftKeyMapper
- rightKeyMapper
- downstream
- func
- @ParallelSupported @IntermediateOp public abstract <U,K,A,D,R> Stream<R> groupJoin(Stream<? extends U> b, Function<? super T,? extends K> leftKeyMapper, Function<? super U,? extends K> rightKeyMapper, Collector<? super U,A,D> downstream, BiFunction<? super T,? super D,R> func)
U
- K
- A
- D
- R
- b
- leftKeyMapper
- rightKeyMapper
- downstream
- func
- @SequentialOnly @IntermediateOp public abstract Stream<List<T>> cartesianProduct(Collection<? extends Collection<? extends T>> cs)
@ParallelSupported @IntermediateOp public abstract Stream<T> peekFirst(Consumer<? super T> action)
@ParallelSupported @IntermediateOp public abstract Stream<T> peekLast(Consumer<? super T> action)
@ParallelSupported @IntermediateOp public abstract Stream<T> intersection(Function<? super T,?> mapper, Collection<?> c)
mapper
.mapper
- c
- IntList.intersection(IntList)
@ParallelSupported @IntermediateOp public abstract Stream<T> difference(Function<? super T,?> mapper, Collection<?> c)
mapper
.mapper
- c
- IntList.difference(IntList)
@SequentialOnly @IntermediateOp public final Stream<T> defaultIfEmpty(T defaultValue)
defaultValue
- appendIfEmpty(Object...)
@SequentialOnly @IntermediateOp public final Stream<T> defaultIfEmpty(Supplier<? extends Stream<T>> supplier)
supplier
- BaseStream.appendIfEmpty(Supplier)
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> prepend(T... a)
@SequentialOnly @IntermediateOp public abstract Stream<T> prepend(Collection<? extends T> c)
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> append(T... a)
@SequentialOnly @IntermediateOp public abstract Stream<T> append(Collection<? extends T> c)
@SequentialOnly @IntermediateOp @SafeVarargs public final Stream<T> appendIfEmpty(T... a)
@SequentialOnly @IntermediateOp public abstract Stream<T> appendIfEmpty(Collection<? extends T> c)
@SequentialOnly @IntermediateOp public abstract Stream<T> cycled()
@SequentialOnly @IntermediateOp public abstract Stream<T> cycled(long times)
@SequentialOnly @IntermediateOp @TerminalOpTriggered public abstract Stream<List<T>> rollup()
@SequentialOnly @IntermediateOp public abstract Stream<T> queued()
@SequentialOnly @IntermediateOp public abstract Stream<T> queued(int queueSize)
queueSize
- @SequentialOnly @IntermediateOp public abstract Stream<T> merge(Stream<? extends T> b, BiFunction<? super T,? super T,MergeResult> nextSelector)
b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.@ParallelSupported @IntermediateOp public abstract <T2,R> Stream<R> zipWith(Stream<T2> b, BiFunction<? super T,? super T2,R> zipFunction)
@ParallelSupported @IntermediateOp public abstract <T2,T3,R> Stream<R> zipWith(Stream<T2> b, Stream<T3> c, TriFunction<? super T,? super T2,? super T3,R> zipFunction)
@ParallelSupported @IntermediateOp public abstract <T2,R> Stream<R> zipWith(Stream<T2> b, T valueForNoneA, T2 valueForNoneB, BiFunction<? super T,? super T2,R> zipFunction)
@ParallelSupported @IntermediateOp public abstract <T2,T3,R> Stream<R> zipWith(Stream<T2> b, Stream<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, TriFunction<? super T,? super T2,? super T3,R> zipFunction)
@SequentialOnly @TerminalOp public abstract long persist(File file) throws IOException
IOException
@SequentialOnly @TerminalOp public abstract long persist(Throwables.Function<? super T,String,IOException> toLine, File file) throws IOException
IOException
@SequentialOnly @TerminalOp public abstract long persist(Throwables.Function<? super T,String,IOException> toLine, OutputStream os) throws IOException
IOException
@SequentialOnly @TerminalOp public abstract long persist(Throwables.Function<? super T,String,IOException> toLine, Writer writer) throws IOException
IOException
@SequentialOnly @TerminalOp public abstract long persist(Throwables.Function<? super T,String,IOException> toLine, String header, String tail, Writer writer) throws IOException
IOException
@SequentialOnly @TerminalOp public abstract long persist(Connection conn, String insertSQL, int batchSize, int batchInterval, Throwables.BiConsumer<? super PreparedStatement,? super T,SQLException> stmtSetter) throws SQLException
SQLException
@SequentialOnly @TerminalOp public abstract long persist(PreparedStatement stmt, int batchSize, int batchInterval, Throwables.BiConsumer<? super PreparedStatement,? super T,SQLException> stmtSetter) throws SQLException
SQLException
@SequentialOnly @IntermediateOp public abstract Stream<T> toJdkStream()
@SequentialOnly @IntermediateOp @Beta public <E extends Exception> ExceptionalStream<T,E> checked()
E
- cls
- @SequentialOnly @IntermediateOp @Beta public <E extends Exception> ExceptionalStream<T,E> checked(Class<E> cls)
E
- cls
- @SequentialOnly public ObjIterator<T> iterator()
@Beta public <E extends Exception> ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super Stream<T>,E> action)
action
- a terminal operation should be called.@Beta public <E extends Exception> ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super Stream<T>,E> action, Executor executor)
action
- a terminal operation should be called.executor
- @Beta public <R,E extends Exception> ContinuableFuture<R> asyncCall(Throwables.Function<? super Stream<T>,R,E> action)
action
- a terminal operation should be called.@Beta public <R,E extends Exception> ContinuableFuture<R> asyncCall(Throwables.Function<? super Stream<T>,R,E> action, Executor executor)
action
- a terminal operation should be called.executor
- @SequentialOnly @IntermediateOp @Beta public <SS extends BaseStream> SS __(Function<? super Stream<T>,SS> transfer)
@Deprecated @SequentialOnly @Beta public abstract <K,V> Stream<NoCachingNoUpdating.DisposableEntry<K,V>> mapToDisposableEntry(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
DisposableEntry
is created,
and the same entry instance is returned and set with different keys/values during iteration of the returned stream.
The elements only can be retrieved one by one, can't be modified or saved.
The returned Stream doesn't support the operations which require two or more elements at the same time: (e.g. sort/distinct/pairMap/slidingMap/sliding/split/toList/toSet/...).
, and can't be parallel stream.
Operations: filter/map/toMap/groupBy/groupTo/... are supported.keyMapper
- valueMapper
- NoCachingNoUpdating.DisposableEntry
,
NoCachingNoUpdating
public static <T> Stream<T> empty()
public static <T> Stream<T> just(T a)
public static <T> Stream<T> ofNullable(T t)
@SafeVarargs public static <T> Stream<T> of(T... a)
public static <T> Stream<T> of(T[] a, int startIndex, int endIndex)
a
- startIndex
- endIndex
- public static <T> Stream<T> of(Collection<? extends T> c)
c
- public static <T> Stream<T> of(Collection<? extends T> c, int startIndex, int endIndex)
c
- startIndex
- endIndex
- public static <T> Stream<T> of(Enumeration<? extends T> enumeration)
public static <T> Stream<T> of(Supplier<Collection<? extends T>> supplier)
supplier
- public static <T> Stream<T> flatten(Collection<? extends Collection<? extends T>> c)
public static <T> Stream<T> flatten(T[][] a)
public static <T> Stream<T> flatten(T[][] a, boolean vertically)
public static <T> Stream<T> flatten(T[][] a, T valueForNone, boolean vertically)
public static <T> Stream<T> flatten(T[][][] a)
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 init, BooleanSupplier hasNext, UnaryOperator<T> f)
Stream
produced by iterative
application of a function f
to an initial element init
,
producing a Stream
consisting of init
, f(init)
,
f(f(init))
, etc.
The first element (position 0
) in the Stream
will be
the provided init
. For n > 0
, the element at position
n
, will be the result of applying the function f
to the
element at position n - 1
.
init
- hasNext
- f
- public static <T> Stream<T> iterate(T init, Predicate<? super T> hasNext, UnaryOperator<T> f)
init
- hasNext
- test if has next by hasNext.test(init) for first time and hasNext.test(f.apply(previous)) for remaining.f
- public static <T> Stream<T> iterate(T init, 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, 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, TimeUnit unit, LongFunction<T> s)
delay
- interval
- unit
- s
- public static Stream<Object[]> rows(ResultSet resultSet) throws UncheckedSQLException
resultSet
after the stream is finished.resultSet
- UncheckedSQLException
public static <T> Stream<T> rows(Class<T> targetClass, ResultSet resultSet) throws UncheckedSQLException
resultSet
after the stream is finished.targetClass
- Array/List/Map or Entity with getter/setter methods.resultSet
- UncheckedSQLException
public static <T> Stream<T> rows(ResultSet resultSet, Throwables.Function<ResultSet,T,SQLException> rowMapper) throws UncheckedSQLException
resultSet
after the stream is finished.resultSet
- rowMapper
- UncheckedSQLException
public static <T> Stream<T> rows(ResultSet resultSet, Throwables.BiFunction<ResultSet,List<String>,T,SQLException> rowMapper) throws UncheckedSQLException
resultSet
after the stream is finished.resultSet
- rowMapper
- UncheckedSQLException
public static <T> Stream<T> rows(ResultSet resultSet, int columnIndex) throws UncheckedSQLException
resultSet
after the stream is finished.resultSet
- columnIndex
- starts from 0, not 1.UncheckedSQLException
public static <T> Stream<T> rows(ResultSet resultSet, String columnName) throws UncheckedSQLException
resultSet
after the stream is finished.resultSet
- columnName
- UncheckedSQLException
public static Stream<String> lines(File file) throws UncheckedIOException
UncheckedIOException
public static Stream<String> lines(File file, Charset charset) throws UncheckedIOException
UncheckedIOException
public static Stream<String> lines(Path path) throws UncheckedIOException
UncheckedIOException
public static Stream<String> lines(Path path, Charset charset) throws UncheckedIOException
UncheckedIOException
public static Stream<String> lines(Reader reader) throws UncheckedIOException
reader
after the stream is finished.reader
- UncheckedIOException
public static Stream<File> listFiles(File parentPath) throws UncheckedIOException
UncheckedIOException
public static Stream<File> listFiles(File parentPath, boolean recursively) throws UncheckedIOException
UncheckedIOException
public static <T> Stream<T> observe(BlockingQueue<T> queue, Duration duration)
public static <T> Stream<T> observe(BlockingQueue<T> queue, Duration duration, Runnable onComplete)
final BlockingQueue queue = new ArrayBlockingQueue<>(32);
Stream.observe(queue, Duration.ofMillis(100)).filter(s -> s.startsWith("a")).asyncRun(s -> s.forEach(Fn.println()));
N.asList("a", "b", "ab", "bc", "1", "a").forEach(queue::add);
N.sleep(10);
N.println("==================");
N.sleep(100);
N.println("==================");
N.sleep(10);
queue
- duration
- onComplete
- public static <T> Stream<T> observe(BlockingQueue<T> queue, BooleanSupplier hasMore, long maxWaitIntervalInMillis)
public static <T> Stream<T> observe(BlockingQueue<T> queue, BooleanSupplier hasMore, long maxWaitIntervalInMillis, Runnable onComplete)
final BlockingQueue queue = new ArrayBlockingQueue<>(32);
final MutableBoolean hasMore = MutableBoolean.of(true);
Stream.observe(queue, () -> hasMore.value(), 10).filter(s -> s.startsWith("a")).asyncRun(s -> s.forEach(Fn.println()));
N.asList("a", "b", "ab", "bc", "1", "a").forEach(queue::add);
N.println("==================");
hasMore.setFalse();
N.sleep(50);
N.println("==================");
queue
- hasMore
- maxWaitIntervalInMillis
- isCompleted
- it will will be set to true
if Stream is completed and the upstream should not continue to put elements to queue when it's completed.
This is an output parameter.@SafeVarargs public static <T> Stream<T> concat(T[]... a)
@SafeVarargs public static <T> Stream<T> concat(Collection<? extends T>... a)
@SafeVarargs public static <T> Stream<T> concat(Iterator<? extends T>... a)
@SafeVarargs public static <T> Stream<T> concat(Stream<? extends T>... a)
public static <T> Stream<T> concat(List<? extends Collection<? extends T>> c)
public static <T> Stream<T> concat(Collection<? extends Stream<? extends T>> c)
public static <T> Stream<T> concatt(Collection<? extends Iterator<? extends T>> c)
@SafeVarargs public static <T> Stream<T> parallelConcat(Iterator<? extends T>... a)
a
- public static <T> Stream<T> parallelConcat(Iterator<? extends T>[] a, int readThreadNum, int queueSize)
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)
a
- public static <T> Stream<T> parallelConcat(Stream<? extends T>[] a, int readThreadNum, int queueSize)
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(Collection<? extends Stream<? extends T>> c)
c
- public static <T> Stream<T> parallelConcat(Collection<? extends Stream<? extends T>> c, int readThreadNum)
c
- readThreadNum
- public static <T> Stream<T> parallelConcat(Collection<? extends Stream<? extends T>> c, int readThreadNum, int queueSize)
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> parallelConcat(List<? extends Collection<? extends T>> c)
c
- public static <T> Stream<T> parallelConcat(List<? extends Collection<? extends T>> c, int readThreadNum)
c
- readThreadNum
- public static <T> Stream<T> parallelConcat(List<? extends Collection<? extends T>> c, int readThreadNum, int queueSize)
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(Collection<? extends Iterator<? extends T>> c)
c
- public static <T> Stream<T> parallelConcatt(Collection<? extends Iterator<? extends T>> c, int readThreadNum)
c
- readThreadNum
- public static <T> Stream<T> parallelConcatt(Collection<? extends Iterator<? extends T>> c, int readThreadNum, int queueSize)
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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(Collection<? extends A> a, Collection<? extends B> b, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- public static <A,B,C,R> Stream<R> zip(Collection<? extends A> a, Collection<? extends B> b, Collection<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction)
a
- b
- public static <A,B,R> Stream<R> zip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- public static <A,B,C,R> Stream<R> zip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction)
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(List<? extends Collection<? extends T>> c, Function<? super List<? extends T>,R> zipFunction)
public static <T,R> Stream<R> zip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,R> zipFunction)
c
- zipFunction
- public static <T,R> Stream<R> zipp(Collection<? extends Iterator<? extends T>> c, Function<? super 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(Collection<? extends A> a, 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(Collection<? extends A> a, Collection<? extends B> b, 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(Iterator<? extends A> a, 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(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction)
a
- 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(List<? extends Collection<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,R> zipFunction)
public static <T,R> Stream<R> zip(Collection<? extends Stream<? extends T>> c, List<? extends T> valuesForNone, Function<? super 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(Collection<? extends Iterator<? extends T>> c, List<? extends T> valuesForNone, Function<? super 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(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- zipFunction
- public static <A,B,R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, BiFunction<? super A,? super B,R> zipFunction, int queueSize)
a
- b
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <A,B,C,R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction)
public static <A,B,C,R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, TriFunction<? super A,? super B,? super C,R> zipFunction, int queueSize)
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <A,B,R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, BiFunction<? super A,? super B,R> zipFunction)
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)
a
- b
- zipFunction
- queueSize
- for each iterator. Default value is 32public 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)
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <T,R> Stream<R> parallelZip(List<? extends Collection<? extends T>> c, Function<? super List<? extends T>,R> zipFunction)
public static <T,R> Stream<R> parallelZip(List<? extends Collection<? extends T>> c, Function<? super List<? extends T>,R> zipFunction, int queueSize)
public static <T,R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,R> zipFunction)
c
- zipFunction
- public static <T,R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, Function<? super List<? extends T>,R> zipFunction, int queueSize)
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <T,R> Stream<R> parallelZipp(Collection<? extends Iterator<? extends T>> c, Function<? super List<? extends T>,R> zipFunction)
c
- zipFunction
- public static <T,R> Stream<R> parallelZipp(Collection<? extends Iterator<? extends T>> c, Function<? super List<? extends T>,R> zipFunction, int queueSize)
a
- b
- c
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <A,B,R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction)
a
- b
- valueForNoneA
- valueForNoneB
- zipFunction
- public static <A,B,R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction, int queueSize)
a
- b
- valueForNoneA
- valueForNoneB
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <A,B,C,R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction)
a
- b
- c
- valueForNoneA
- valueForNoneB
- valueForNoneC
- zipFunction
- public static <A,B,C,R> Stream<R> parallelZip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction, int queueSize)
a
- b
- c
- valueForNoneA
- valueForNoneB
- valueForNoneC
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <A,B,R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A,? super B,R> zipFunction)
a
- 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)
a
- b
- valueForNoneA
- valueForNoneB
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <A,B,C,R> Stream<R> parallelZip(Stream<A> a, Stream<B> b, Stream<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A,? super B,? super C,R> zipFunction)
a
- 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)
a
- b
- c
- valueForNoneA
- valueForNoneB
- valueForNoneC
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <T,R> Stream<R> parallelZip(List<? extends Collection<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,R> zipFunction)
public static <T,R> Stream<R> parallelZip(List<? extends Collection<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,R> zipFunction, int queueSize)
public static <T,R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,R> zipFunction)
c
- valuesForNone
- zipFunction
- public static <T,R> Stream<R> parallelZip(Collection<? extends Stream<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,R> zipFunction, int queueSize)
c
- valuesForNone
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <T,R> Stream<R> parallelZipp(Collection<? extends Iterator<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,R> zipFunction)
c
- valuesForNone
- zipFunction
- public static <T,R> Stream<R> parallelZipp(Collection<? extends Iterator<? extends T>> c, List<? extends T> valuesForNone, Function<? super List<? extends T>,R> zipFunction, int queueSize)
c
- valuesForNone
- zipFunction
- queueSize
- for each iterator. Default value is 32public static <T> Stream<T> merge(T[] a, T[] b, BiFunction<? super T,? super T,MergeResult> 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,MergeResult> 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(Collection<? extends T> a, Collection<? extends T> b, BiFunction<? super T,? super T,MergeResult> 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(Collection<? extends T> a, Collection<? extends T> b, Collection<? extends T> c, BiFunction<? super T,? super T,MergeResult> 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(Iterator<? extends T> a, Iterator<? extends T> b, BiFunction<? super T,? super T,MergeResult> 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(Iterator<? extends T> a, Iterator<? extends T> b, Iterator<? extends T> c, BiFunction<? super T,? super T,MergeResult> 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,MergeResult> 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,MergeResult> nextSelector)
public static <T> Stream<T> merge(List<? extends Collection<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
public static <T> Stream<T> merge(Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> mergge(Collection<? extends Iterator<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> parallelMerge(List<? extends Collection<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
public static <T> Stream<T> parallelMerge(List<? extends Collection<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector, int maxThreadNum)
public static <T> Stream<T> parallelMerge(Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> parallelMerge(Collection<? extends Stream<? extends T>> c, BiFunction<? super T,? super T,MergeResult> 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(Collection<? extends Iterator<? extends T>> c, BiFunction<? super T,? super T,MergeResult> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static <T> Stream<T> parallelMergge(Collection<? extends Iterator<? extends T>> c, BiFunction<? super T,? super T,MergeResult> 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 String join(CharSequence delimiter)
join
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()
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>>
public S sequential()
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()
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>>
public S parallel(int maxThreadNum)
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>>
public S parallel(BaseStream.Splitor splitor)
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>>
public S parallel(int maxThreadNum, BaseStream.Splitor splitor)
BaseStream
maxThreadNum
and splitor
as the specified ones.
Profiler.run(1, 1, 3, "sequential", () -> Stream.of(list).operation(F)...).printResult();
Profiler.run(1, 1, 3, "parallel", () -> Stream.of(list).parallel().operation(F)...).printResult();
Here is a sample performance test with computer: CPU Intel i7-3520M 4-cores 2.9 GHz, JDK 1.8.0_101, Windows 7:
public void test_perf() {
final String[] strs = new String[10_000];
N.fill(strs, N.uuid());
final int m = 1;
final Function mapper = str -> {
long result = 0;
for (int i = 0; i < m; i++) {
result += sum(str.toCharArray()) + 1;
}
return result;
};
final MutableLong sum = MutableLong.of(0);
for (int i = 0, len = strs.length; i < len; i++) {
sum.add(mapper.apply(strs[i]));
}
final int threadNum = 1, loopNum = 100, roundNum = 3;
Profiler.run(threadNum, loopNum, roundNum, "For Loop", () -> {
long result = 0;
for (int i = 0, len = strs.length; i < len; i++) {
result += mapper.apply(strs[i]);
}
assertEquals(sum.longValue(), result);
}).printResult();
Profiler.run(threadNum, loopNum, roundNum, "JDK Sequential",
() -> assertEquals(sum.longValue(), java.util.stream.Stream.of(strs).map(mapper).mapToLong(e -> e).sum())).printResult();
Profiler.run(threadNum, loopNum, roundNum, "JDK Parallel",
() -> assertEquals(sum.longValue(), java.util.stream.Stream.of(strs).parallel().map(mapper).mapToLong(e -> e).sum())).printResult();
Profiler.run(threadNum, loopNum, roundNum, "Abcus Sequential",
() -> assertEquals(sum.longValue(), Stream.of(strs).map(mapper).mapToLong(e -> e).sum().longValue())).printResult();
Profiler.run(threadNum, loopNum, roundNum, "Abcus Parallel",
() -> assertEquals(sum.longValue(), Stream.of(strs).parallel().map(mapper).mapToLong(e -> e).sum().longValue())).printResult();
}
And test result: Unit is milliseconds. N(the number of elements) is 10_000, Q(cost per element of F, the per-element function (usually a lambda), here is mapper
) is calculated by: value of 'For loop' / N(10_000).
m = 1 | m = 10 | m = 50 | m = 100 | m = 500 | m = 1000 | |
---|---|---|---|---|---|---|
Q | 0.00002 | 0.0002 | 0.001 | 0.002 | 0.01 | 0.02 |
For Loop | 0.23 | 2.3 | 11 | 22 | 110 | 219 |
JDK Sequential | 0.28 | 2.3 | 11 | 22 | 114 | 212 |
JDK Parallel | 0.22 | 1.3 | 6 | 12 | 66 | 122 |
Abcus Sequential | 0.3 | 2 | 11 | 22 | 112 | 212 |
Abcus Parallel | 11 | 11 | 11 | 16 | 77 | 128 |
f = (int a, int b) -> a + b;
.
But if we look into the samples in the article and think about it: it just takes less than 1 milliseconds to get the max value in 100k numbers.
There is potential performance issue only if the "get the max value in 100K numbers" call many, many times in your API or single request.
Otherwise, the difference between 0.1 milliseconds to 0.5 milliseconds can be totally ignored.
Usually we meet performance issue only if Q and F is big enough. However, the performance of Lambdas/Streams APIs is closed to for loop when Q and F is big enough.
No matter in which scenario, We don't need and should not concern the performance of Lambdas/Stream APIs.
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>>
maxThreadNum
- Default value is the number of cpu-cores. Steps/operations will be executed sequentially if maxThreadNum
is 1.splitor
- The target array is split by ranges for multiple threads if splitor is splitor.ARRAY
and target stream composed by array. It looks like:
for (int i = 0; i < maxThreadNum; i++) {
final int sliceIndex = i;
futureList.add(asyncExecutor.execute(new Runnable() {
public void run() {
int cursor = fromIndex + sliceIndex * sliceSize;
final int to = toIndex - cursor > sliceSize ? cursor + sliceSize : toIndex;
while (cursor < to) {
action.accept(elements[cursor++]);
}
}
}));
}
Otherwise, each thread will get the elements from the target array/iterator in the stream one by one with the target array/iterator synchronized. It looks like:
for (int i = 0; i < maxThreadNum; i++) {
futureList.add(asyncExecutor.execute(new Runnable() {
public void run() {
T next = null;
while (true) {
synchronized (elements) {
if (cursor.intValue() < toIndex) {
next = elements[cursor.getAndIncrement()];
} else {
break;
}
}
action.accept(next);
}
}
}));
}
Using splitor.ARRAY
only when F (the per-element function (usually a lambda)) is very tiny and the cost of synchronization on the target array/iterator is too big to it.
For the F involving IO or taking 'long' to complete, choose splitor.ITERATOR
. Default value is splitor.ITERATOR
.MergeResult
,
com.landawn.abacus.util.Profiler#run(int, int, int, String, Runnable)
,
Understanding Parallel Stream Performance in Java SE 8,
When to use parallel Streamspublic S parallel(int maxThreadNum, BaseStream.Splitor splitor, Executor executor)
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>>
executor
- should be able to execute maxThreadNum
* following up operations
in parallel.public S parallel(int maxThreadNum, Executor executor)
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>>
executor
- should be able to execute maxThreadNum
* following up operations
in parallel.public S parallel(Executor executor)
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>>
executor
- should be able to execute maxThreadNum
* following up operations
in parallel.public void close()
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 AutoCloseable
Copyright © 2020. All rights reserved.