public final class MathFlux extends Object
Comparable
values or using custom Comparator
.Modifier and Type | Method and Description |
---|---|
static Mono<BigDecimal> |
averageBigDecimal(org.reactivestreams.Publisher<? extends Number> source)
Computes the
BigDecimal average of items in the source. |
static <T> Mono<BigDecimal> |
averageBigDecimal(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the
BigDecimal average of items in the source, which are mapped to
numerical values using the provided mapping. |
static Mono<BigInteger> |
averageBigInteger(org.reactivestreams.Publisher<? extends Number> source)
Computes the
BigInteger average of items in the source. |
static <T> Mono<BigInteger> |
averageBigInteger(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the
BigInteger average of items in the source, which are mapped to
numerical values using the provided mapping. |
static Mono<Double> |
averageDouble(org.reactivestreams.Publisher<? extends Number> source)
Computes the double average of items in the source.
|
static <T> Mono<Double> |
averageDouble(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the double average of items in the source, which are mapped to numerical values
using the provided mapping.
|
static Mono<Float> |
averageFloat(org.reactivestreams.Publisher<? extends Number> source)
Computes the float average of items in the source.
|
static <T> Mono<Float> |
averageFloat(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the float average of items in the source, which are mapped to numerical values
using the provided mapping.
|
static <T extends Comparable<? super T>> |
max(org.reactivestreams.Publisher<T> source)
Computes the maximum value of items in the source.
|
static <T> Mono<T> |
max(org.reactivestreams.Publisher<T> source,
Comparator<? super T> comparator)
Computes the maximum value of items in the source.
|
static <T extends Comparable<? super T>> |
min(org.reactivestreams.Publisher<T> source)
Computes the minimum value of items in the source.
|
static <T> Mono<T> |
min(org.reactivestreams.Publisher<T> source,
Comparator<? super T> comparator)
Computes the minimum value of items in the source.
|
static Mono<BigDecimal> |
sumBigDecimal(org.reactivestreams.Publisher<? extends Number> source)
Computes the
BigDecimal sum of items in the source. |
static <T> Mono<BigDecimal> |
sumBigDecimal(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the
BigDecimal sum of items in the source, which are
mapped to numerical values using provided mapping. |
static Mono<BigInteger> |
sumBigInteger(org.reactivestreams.Publisher<? extends Number> source)
Computes the
BigInteger sum of items in the source. |
static <T> Mono<BigInteger> |
sumBigInteger(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the
BigInteger sum of items in the source, which are mapped to
numerical values using provided mapping. |
static Mono<Double> |
sumDouble(org.reactivestreams.Publisher<? extends Number> source)
Computes the double sum of items in the source.
|
static <T> Mono<Double> |
sumDouble(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the double sum of items in the source, which are mapped to numerical values
using the provided mapping.
|
static Mono<Float> |
sumFloat(org.reactivestreams.Publisher<? extends Number> source)
Computes the float sum of items in the source.
|
static <T> Mono<Float> |
sumFloat(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the float sum of items in the source, which are mapped to numerical values
using the provided mapping.
|
static Mono<Integer> |
sumInt(org.reactivestreams.Publisher<? extends Number> source)
Computes the integer sum of items in the source.
|
static <T> Mono<Integer> |
sumInt(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the integer sum of items in the source, which are mapped to numerical values
using the provided mapping.
|
static Mono<Long> |
sumLong(org.reactivestreams.Publisher<? extends Number> source)
Computes the long sum of items in the source.
|
static <T> Mono<Long> |
sumLong(org.reactivestreams.Publisher<T> source,
Function<? super T,? extends Number> mapping)
Computes the long sum of items in the source, which are mapped to numerical values
using the provided mapping.
|
public static Mono<Integer> sumInt(org.reactivestreams.Publisher<? extends Number> source)
Integer.MAX_VALUE
(or Integer.MIN_VALUE
for an underflow).source
- the numerical sourceMono
of the sum of items in sourcepublic static final <T> Mono<Integer> sumInt(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
Integer.MAX_VALUE
(or Integer.MIN_VALUE
for an underflow).source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the sum of items in sourcepublic static Mono<Long> sumLong(org.reactivestreams.Publisher<? extends Number> source)
Long.MAX_VALUE
(or Long.MIN_VALUE
for an underflow).source
- the numerical sourceMono
of the sum of items in sourcepublic static final <T> Mono<Long> sumLong(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
Long.MAX_VALUE
(or Long.MIN_VALUE
for an underflow).source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the sum of items in sourcepublic static Mono<Float> sumFloat(org.reactivestreams.Publisher<? extends Number> source)
source
- the numerical sourceMono
of the sum of items in sourcepublic static final <T> Mono<Float> sumFloat(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the sum of items in sourcepublic static Mono<Double> sumDouble(org.reactivestreams.Publisher<? extends Number> source)
source
- the numerical sourceMono
of the sum of items in sourcepublic static final <T> Mono<Double> sumDouble(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the sum of items in sourcepublic static Mono<BigInteger> sumBigInteger(org.reactivestreams.Publisher<? extends Number> source)
BigInteger
sum of items in the source.
Further conversion of individual elements to BigDecimal
is always applied to
retain maximum precision. When the sum is ultimately produced, it can be rounded or
truncated as a BigDecimal.toBigInteger()
final conversion is applied.
source
- the numerical sourceMono
of the sum of items in sourcepublic static final <T> Mono<BigInteger> sumBigInteger(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
BigInteger
sum of items in the source, which are mapped to
numerical values using provided mapping.
Further conversion of individual elements to BigDecimal
is always applied to
retain maximum precision. When the sum is ultimately produced, it can be rounded or
truncated as a BigDecimal.toBigInteger()
final conversion is applied.
source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of sum of items in sourcepublic static Mono<BigDecimal> sumBigDecimal(org.reactivestreams.Publisher<? extends Number> source)
BigDecimal
sum of items in the source.source
- the numerical sourceMono
of the sum of items in sourcepublic static final <T> Mono<BigDecimal> sumBigDecimal(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
BigDecimal
sum of items in the source, which are
mapped to numerical values using provided mapping.source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of sum of items in sourcepublic static Mono<Float> averageFloat(org.reactivestreams.Publisher<? extends Number> source)
source
- the numerical sourceMono
of the average of items in sourcepublic static final <T> Mono<Float> averageFloat(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the average of items in sourcepublic static Mono<Double> averageDouble(org.reactivestreams.Publisher<? extends Number> source)
source
- the numerical sourceMono
of the average of items in sourcepublic static final <T> Mono<Double> averageDouble(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the average of items in sourcepublic static Mono<BigInteger> averageBigInteger(org.reactivestreams.Publisher<? extends Number> source)
BigInteger
average of items in the source.
The average is computed by summing BigDecimal
-converted values and ultimately
dividing that number by the number of elements. Eventually the result of that division
can be rounded or truncated, as the FLOOR rounding mode
is applied and the BigDecimal.toBigInteger()
final conversion is performed.
source
- the numerical sourceMono
of the average of items in sourcepublic static final <T> Mono<BigInteger> averageBigInteger(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
BigInteger
average of items in the source, which are mapped to
numerical values using the provided mapping.
Further conversion of individual elements to BigDecimal
is always applied.
The average is computed by summing BigDecimal
-converted values and ultimately
dividing that number by the number of elements. Eventually the result of that division
can be rounded or truncated, as the FLOOR rounding mode
is applied and the BigDecimal.toBigInteger()
final conversion is performed.
source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the average of items in sourcepublic static Mono<BigDecimal> averageBigDecimal(org.reactivestreams.Publisher<? extends Number> source)
BigDecimal
average of items in the source.source
- the numerical sourceMono
of the average of items in sourcepublic static final <T> Mono<BigDecimal> averageBigDecimal(org.reactivestreams.Publisher<T> source, Function<? super T,? extends Number> mapping)
BigDecimal
average of items in the source, which are mapped to
numerical values using the provided mapping.source
- the source itemsmapping
- a function to map source items to numerical valuesMono
of the average of items in sourcepublic static final <T extends Comparable<? super T>> Mono<T> max(org.reactivestreams.Publisher<T> source)
source
- the source containing comparable itemsMono
of the maximum value in sourcepublic static <T> Mono<T> max(org.reactivestreams.Publisher<T> source, Comparator<? super T> comparator)
source
- the source containing items to comparecomparator
- the comparator used to compare the items in sourceMono
of the maximum value in sourcepublic static final <T extends Comparable<? super T>> Mono<T> min(org.reactivestreams.Publisher<T> source)
source
- the source containing comparable itemsMono
of the minimum value in sourcepublic static <T> Mono<T> min(org.reactivestreams.Publisher<T> source, Comparator<? super T> comparator)
source
- the source containing items to comparecomparator
- the comparator used to compare the items in sourceMono
of the minimum value in source