public interface BlockingStream<U>
Modifier and Type | Method and Description |
---|---|
default ListX<U> |
block()
React and block
|
default <R,A> R |
block(java.util.stream.Collector<? super U,A,R> collector) |
java.util.Optional<java.util.function.Consumer<java.lang.Throwable>> |
getErrorHandler() |
java.lang.Object |
getLastActive() |
java.util.Optional<java.util.function.Consumer<java.lang.Throwable>> getErrorHandler()
default ListX<U> block()
List<String> strings = new SimpleReact().<Integer, Integer> react(() -> 1, () -> 2, () -> 3)
.then((it) -> it * 100)
.then((it) -> "*" + it)
.block();
In this example, once the current thread of execution meets the React
block method, it will block until all tasks have been completed. The
result will be returned as a List. The Reactive tasks triggered by the
Suppliers are non-blocking, and are not impacted by the block method
until they are complete. Block, only blocks the current thread.java.lang.Object getLastActive()
default <R,A> R block(java.util.stream.Collector<? super U,A,R> collector)
collector
- to perform aggregation / reduction operation on the results
(e.g. to Collect into a List or String)