Class PublisherReducers
java.lang.Object
org.infinispan.reactive.publisher.PublisherReducers
Static factory method class to provide various reducers and finalizers for use with distributed Publisher. Note
that these functions are all serializable by Infinispan assuming that any passed arguments are as well.
- Since:
- 10.0
- Author:
- wburns
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<E>> accumulate
(BiConsumer<E, E> biConsumer) static Function<org.reactivestreams.Publisher<Long>,
CompletionStage<Long>> add()
static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<Boolean>> static Function<org.reactivestreams.Publisher<Boolean>,
CompletionStage<Boolean>> and()
static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<Boolean>> static <I,
E> Function<org.reactivestreams.Publisher<I>, CompletionStage<E>> collect
(Supplier<E> supplier, BiConsumer<E, ? super I> consumer) static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<E>> collectorFinalizer
(Collector<?, E, ?> collector) static <I,
E> Function<org.reactivestreams.Publisher<I>, CompletionStage<E>> collectorReducer
(Collector<? super I, E, ?> collector) static Function<org.reactivestreams.Publisher<?>,
CompletionStage<Long>> count()
static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<E>> static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<E>> max
(Comparator<? super E> comparator) static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<E>> min
(Comparator<? super E> comparator) static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<Boolean>> static Function<org.reactivestreams.Publisher<Boolean>,
CompletionStage<Boolean>> or()
static <I,
E> Function<org.reactivestreams.Publisher<I>, CompletionStage<E>> reduce
(E identity, BiFunction<E, ? super I, E> biFunction) Provides a reduction where the initial value must be the identity value that is not modified via the provided biFunction.static <E> Function<org.reactivestreams.Publisher<E>,
CompletionStage<E>> reduce
(BinaryOperator<E> operator) static <I,
E> Function<org.reactivestreams.Publisher<I>, CompletionStage<E>> reduceWith
(Callable<? extends E> initialSupplier, BiFunction<E, ? super I, E> biFunction) static <E> Function<org.reactivestreams.Publisher<E[]>,
CompletionStage<E[]>> static <E> Function<org.reactivestreams.Publisher<E[]>,
CompletionStage<E[]>> toArrayFinalizer
(IntFunction<E[]> generator) static <I> Function<org.reactivestreams.Publisher<I>,
CompletionStage<Object[]>> static <I extends E,
E>
Function<org.reactivestreams.Publisher<I>,CompletionStage<E[]>> toArrayReducer
(IntFunction<E[]> generator)
-
Method Details
-
and
-
allMatch
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<Boolean>> allMatch(Predicate<? super E> predicate) -
anyMatch
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<Boolean>> anyMatch(Predicate<? super E> predicate) -
collect
public static <I,E> Function<org.reactivestreams.Publisher<I>,CompletionStage<E>> collect(Supplier<E> supplier, BiConsumer<E, ? super I> consumer) -
collectorReducer
public static <I,E> Function<org.reactivestreams.Publisher<I>,CompletionStage<E>> collectorReducer(Collector<? super I, E, ?> collector) -
collectorFinalizer
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<E>> collectorFinalizer(Collector<?, E, ?> collector) -
accumulate
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<E>> accumulate(BiConsumer<E, E> biConsumer) -
findFirst
-
max
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<E>> max(Comparator<? super E> comparator) -
min
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<E>> min(Comparator<? super E> comparator) -
noneMatch
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<Boolean>> noneMatch(Predicate<? super E> predicate) -
or
-
reduce
public static <I,E> Function<org.reactivestreams.Publisher<I>,CompletionStage<E>> reduce(E identity, BiFunction<E, ? super I, E> biFunction) Provides a reduction where the initial value must be the identity value that is not modified via the provided biFunction. Failure to do so will cause unexpected results.If the initial value needs to be modified, you should use
reduceWith(Callable, BiFunction)
instead.- Type Parameters:
I
- input typeE
- output reduced type- Parameters:
identity
- initial identity value to use (this value must not be modified by the provide biFunction)biFunction
- biFunction used to reduce the values into a single one- Returns:
- function that will map a publisher of the input type to a completion stage of the output type
-
reduceWith
public static <I,E> Function<org.reactivestreams.Publisher<I>,CompletionStage<E>> reduceWith(Callable<? extends E> initialSupplier, BiFunction<E, ? super I, E> biFunction) -
reduce
public static <E> Function<org.reactivestreams.Publisher<E>,CompletionStage<E>> reduce(BinaryOperator<E> operator) -
count
-
add
-
toArrayReducer
public static <I> Function<org.reactivestreams.Publisher<I>,CompletionStage<Object[]>> toArrayReducer() -
toArrayReducer
public static <I extends E,E> Function<org.reactivestreams.Publisher<I>,CompletionStage<E[]>> toArrayReducer(IntFunction<E[]> generator) -
toArrayFinalizer
public static <E> Function<org.reactivestreams.Publisher<E[]>,CompletionStage<E[]>> toArrayFinalizer() -
toArrayFinalizer
public static <E> Function<org.reactivestreams.Publisher<E[]>,CompletionStage<E[]>> toArrayFinalizer(IntFunction<E[]> generator)
-