public class ReactiveSeqFutureOpterationsImpl<T> extends BaseFutureOperationsImpl<T>
Constructor and Description |
---|
ReactiveSeqFutureOpterationsImpl(java.util.concurrent.Executor exec,
ReactiveSeq<T> stream) |
Modifier and Type | Method and Description |
---|---|
<X extends java.lang.Throwable> |
forEachEvent(java.util.function.Consumer<? super T> consumerElement,
java.util.function.Consumer<? super java.lang.Throwable> consumerError,
java.lang.Runnable onComplete)
Perform a forEach operation over the Stream capturing any elements and errors in the supplied consumers
when the entire Stream has been processed an onComplete event will be recieved.
|
<X extends java.lang.Throwable> |
forEachWithError(java.util.function.Consumer<? super T> consumerElement,
java.util.function.Consumer<? super java.lang.Throwable> consumerError)
Perform a forEach operation over the Stream capturing any elements and errors in the supplied consumers,
|
<X extends java.lang.Throwable> |
forEachX(long numberOfElements,
java.util.function.Consumer<? super T> consumer)
Perform a forEach operation over the Stream, without closing it, consuming only the specified number of elements from
the Stream, at this time.
|
<X extends java.lang.Throwable> |
forEachXEvents(long numberOfElements,
java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> consumerError,
java.lang.Runnable onComplete)
Perform a forEach operation over the Stream without closing it, capturing any elements and errors in the supplied consumers, but only consuming
the specified number of elements from the Stream, at this time.
|
<X extends java.lang.Throwable> |
forEachXWithError(long numberOfElements,
java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> consumerError)
Perform a forEach operation over the Stream without closing it, capturing any elements and errors in the supplied consumers, but only consuming
the specified number of elements from the Stream, at this time.
|
allMatch, anyMatch, averageDouble, averageInt, averageLong, avg, avg, collect, collect, count, countDistinct, countDistinctBy, findAny, findFirst, firstValue, foldLeft, foldRight, forEach, groupBy, groupBy, groupBy, join, join, join, lastValue, max, max, max, max, maxBy, maxBy, maxDouble, maxInt, maxLong, median, median, medianBy, medianBy, min, min, min, min, minBy, minBy, minDouble, minInt, minLong, mode, noneMatch, percentile, percentile, percentileBy, percentileBy, reduce, reduce, reduce, single, single, singleOptional, sum, sum, sumDouble, sumInt, sumLong, summaryStatisticsDouble, summaryStatisticsInt, summaryStatisticsLong, toArray, toArray, toCollection, toList, toList, toMap, toSet, toSet
public ReactiveSeqFutureOpterationsImpl(java.util.concurrent.Executor exec, ReactiveSeq<T> stream)
public <X extends java.lang.Throwable> ReactiveTask forEachX(long numberOfElements, java.util.function.Consumer<? super T> consumer)
ReactiveStreamsTerminalFutureOperations
ReactiveTask next = ReactiveSeq.of(1,2,3,4)
.futureOperations(exec)
.forEachX(2,System.out::println)
.join();
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
3
4
Second batch processed!
numberOfElements
- To consume from the Stream at this timeconsumer
- To accept incoming events from the Streampublic <X extends java.lang.Throwable> ReactiveTask forEachXWithError(long numberOfElements, java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> consumerError)
ReactiveStreamsTerminalFutureOperations
ReactiveTask next = ReactiveSeq.of(()->1,()->2,()->{throw new RuntimeException()},()->4)
.futureOperations(exec)
.map(Supplier::get)
.forEachXWithError(2,System.out::println, e->e.printStackTrace());
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
RuntimeException Stack Trace on System.err
4
Second batch processed!
numberOfElements
- To consume from the Stream at this timeconsumer
- To accept incoming elements from the StreamconsumerError
- To accept incoming processing errors from the Streampublic <X extends java.lang.Throwable> ReactiveTask forEachXEvents(long numberOfElements, java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> consumerError, java.lang.Runnable onComplete)
ReactiveStreamsTerminalFutureOperations
ReactiveTask next = ReactiveSeq.of(()->1,()->2,()->{throw new RuntimeException()},()->4)
.futureOperations(exec)
.map(Supplier::get)
.forEachXEvents(2,System.out::println, e->e.printStackTrace(),()->System.out.println("the end!"));
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
RuntimeException Stack Trace on System.err
4
Second batch processed!
The end!
numberOfElements
- To consume from the Stream at this timeconsumer
- To accept incoming elements from the StreamconsumerError
- To accept incoming processing errors from the StreamonComplete
- To run after an onComplete eventpublic <X extends java.lang.Throwable> ReactiveTask forEachWithError(java.util.function.Consumer<? super T> consumerElement, java.util.function.Consumer<? super java.lang.Throwable> consumerError)
ReactiveStreamsTerminalFutureOperations
ReactiveTask next = ReactiveSeq.of(()->1,()->2,()->{throw new RuntimeException()},()->4)
.futureOperations(exec)
.map(Supplier::get)
.forEachWithError(System.out::println, e->e.printStackTrace());
System.out.println("processed!");
//prints
1
2
RuntimeException Stack Trace on System.err
4
processed!
consumerElement
- To accept incoming elements from the StreamconsumerError
- To accept incoming processing errors from the Streampublic <X extends java.lang.Throwable> ReactiveTask forEachEvent(java.util.function.Consumer<? super T> consumerElement, java.util.function.Consumer<? super java.lang.Throwable> consumerError, java.lang.Runnable onComplete)
ReactiveStreamsTerminalFutureOperations
ReactiveTask next = ReactiveSeq.of(()->1,()->2,()->{throw new RuntimeException()},()->4)
.futureOperations(exec)
.map(Supplier::get)
.forEachEvents(System.out::println, e->e.printStackTrace(),()->System.out.println("the end!"));
System.out.println("processed!");
//prints
1
2
RuntimeException Stack Trace on System.err
4
processed!
consumerElement
- To accept incoming elements from the StreamconsumerError
- To accept incoming processing errors from the StreamonComplete
- To run after an onComplete event