T
- Element data in the Stream being processed.public interface ReactiveStreamsTerminalOperations<T>
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.
|
<X extends java.lang.Throwable> org.reactivestreams.Subscription forEachX(long numberOfElements, java.util.function.Consumer<? super T> consumer)
Subscription next = ReactiveSeq.of(1,2,3,4)
.forEachX(2,System.out::println);
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 Stream<X extends java.lang.Throwable> org.reactivestreams.Subscription forEachXWithError(long numberOfElements, java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> consumerError)
Subscription next = ReactiveSeq.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.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 Stream<X extends java.lang.Throwable> org.reactivestreams.Subscription forEachXEvents(long numberOfElements, java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> consumerError, java.lang.Runnable onComplete)
Subscription next = ReactiveSeq.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.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 event<X extends java.lang.Throwable> void forEachWithError(java.util.function.Consumer<? super T> consumerElement, java.util.function.Consumer<? super java.lang.Throwable> consumerError)
Subscription next = ReactiveSeq.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.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 Stream<X extends java.lang.Throwable> void forEachEvent(java.util.function.Consumer<? super T> consumerElement, java.util.function.Consumer<? super java.lang.Throwable> consumerError, java.lang.Runnable onComplete)
Subscription next = ReactiveSeq.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.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