Package

## Class MathFluxExtensionsKt

• All Implemented Interfaces:

```
public final class MathFluxExtensionsKt

```
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
• ### Field Summary

Fields
Modifier and Type Field Description
• ### Constructor Summary

Constructors
Constructor Description
• ### Enum Constant Summary

Enum Constants
Enum Constant Description
• ### Method Summary

Modifier and Type Method Description
`final static <T extends Number> Mono<T>` `sumAll(Flux<T> \$self) ` General purpose extension function to compute the sum of all values emitted by a Flux of Number and return it as a Mono.
`final static <T extends Any, R extends Number> Mono<R>` `sumAll(Flux<T> \$self, Function1<T, R> mapper) ` General purpose extension function to map arbitrary values in a Flux to Numbers and return the sum of these Numbers as a Mono of Number.
`final static <T extends Number> Mono<Long>` `sum(Flux<T> \$self) ` Extension to compute the Long sum of all values emitted by a Flux of Number and return it as a Mono of Long.
`final static <T extends Any> Mono<Long>` `sum(Flux<T> \$self, Function1<T, Number> mapper) ` Extension to map arbitrary values in a Flux to Numbers and return the sum of these Numbers as a Mono of Long.
`final static <T extends Number> Mono<Integer>` `sumAsInt(Flux<T> \$self) ` Extension to compute the Int sum of all values emitted by a Flux of Number and return it as a Mono of Int.
`final static <T extends Number> Mono<Long>` `sumAsLong(Flux<T> \$self) ` Extension to compute the Long sum of all values emitted by a Flux of Number and return it as a Mono of Long.
`final static <T extends Number> Mono<Float>` `sumAsFloat(Flux<T> \$self) ` Extension to compute the Float sum of all values emitted by a Flux of Number and return it as a Mono of Float.
`final static <T extends Number> Mono<Double>` `sumAsDouble(Flux<T> \$self) ` Extension to compute the Double sum of all values emitted by a Flux of Number and return it as a Mono of Double.
`final static <T extends Number> Mono<Double>` `sumDouble(Flux<T> \$self) ` Extension to compute the Double sum of all values emitted by a Flux of Number and return it as a Mono of Double.
`final static <T extends Any> Mono<Double>` `sumDouble(Flux<T> \$self, Function1<T, Number> mapper) ` Extension to map arbitrary values in a Flux to Numbers and return the sum of these Numbers as a Mono of Double, thus avoiding rounding down to zero decimal places.
`final static <T extends Number> Mono<BigInteger>` `sumAsBigInt(Flux<T> \$self) ` Extension to compute the BigInteger sum of all values emitted by a Flux of Number and return it as a Mono of BigInteger.
`final static <T extends Number> Mono<BigDecimal>` `sumAsBigDecimal(Flux<T> \$self) ` Extension to compute the BigDecimal sum of all values emitted by a Flux of Number and return it as a Mono of BigDecimal.
`final static <T extends Number> Mono<T>` `averageAll(Flux<T> \$self) ` General purpose extension function to compute the average of all values emitted by a Flux of Number and return it as a Mono.
`final static <T extends Any, R extends Number> Mono<R>` `averageAll(Flux<T> \$self, Function1<T, R> mapper) ` General purpose extension function to map arbitrary values in a Flux to Numbers and return the average of these Numbers as a Mono of Number.
`final static <T extends Number> Mono<Double>` `average(Flux<T> \$self) ` Extension to compute the Double average of all values emitted by a Flux of Number and return it as a Mono of Double.
`final static <T extends Any> Mono<Double>` `average(Flux<T> \$self, Function1<T, Number> mapper) ` Extension to map arbitrary values in a Flux to Numbers and return the average of these Numbers as a Mono of Double.
`final static <T extends Number> Mono<Float>` `averageAsFloat(Flux<T> \$self) ` Extension to compute the Float average of all values emitted by a Flux of Number and return it as a Mono of Float.
`final static <T extends Number> Mono<Double>` `averageAsDouble(Flux<T> \$self) ` Extension to compute the Double average of all values emitted by a Flux of Number and return it as a Mono of Double.
`final static <T extends Number> Mono<BigInteger>` `averageAsBigInt(Flux<T> \$self) ` Extension to compute the BigInteger average of all values emitted by a Flux of Number and return it as a Mono of BigInteger.
`final static <T extends Number> Mono<BigDecimal>` `averageAsBigDecimal(Flux<T> \$self) ` Extension to compute the BigDecimal average of all values emitted by a Flux of Number and return it as a Mono of BigDecimal.
`final static <T extends Comparable<T>> Mono<T>` `min(Flux<T> \$self) ` Extension to find the lowest value in a Flux of Comparable values and return it as a Mono of T.
`final static <T extends Any> Mono<T>` `min(Flux<T> \$self, Comparator<T> comp) ` Extension to find the lowest value in a Flux and return it as a Mono.
`final static <T extends Any> Mono<T>` `min(Flux<T> \$self, Function2<T, T, Integer> comp) ` Extension to find the lowest value in a Flux and return it as a Mono.
`final static <T extends Comparable<T>> Mono<T>` `max(Flux<T> \$self) ` Extension to find the highest value in a Flux of Comparable values and return it as a Mono of T.
`final static <T extends Any> Mono<T>` `max(Flux<T> \$self, Comparator<T> comp) ` Extension to find the highest value in a Flux and return it as a Mono.
`final static <T extends Any> Mono<T>` `max(Flux<T> \$self, Function2<T, T, Integer> comp) ` Extension to find the highest value in a Flux and return it as a Mono.
• ### Methods inherited from class java.lang.Object

```clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait```

• ### Method Detail

• #### sumAll

` final static <T extends Number> Mono<T> sumAll(Flux<T> \$self)`

General purpose extension function to compute the sum of all values emitted by a Flux of Number and return it as a Mono. The resultant Mono will have the same Number type as the input Flux

If the result type (or precision) needs to be changed then a specific sumAsType() method should be used in preference to this method. e.g. sumAsDouble() can be used to compute the sum as a Mono of Double

• #### sumAll

` final static <T extends Any, R extends Number> Mono<R> sumAll(Flux<T> \$self, Function1<T, R> mapper)`

General purpose extension function to map arbitrary values in a Flux to Numbers and return the sum of these Numbers as a Mono of Number. The resultant Mono will have the same Number type as the output of the mapping function

If the result type (or precision) needs to be changed then a specific sumAsType() method should be used in preference to this method. e.g. sumAsDouble() can be used to compute the sum as a Mono of Double

Parameters:
`mapper` - a lambda converting values to Number
• #### sum

`@Deprecated(message = "Use sumAsLong() instead", replaceWith = @ReplaceWith(imports = {"reactor.kotlin.extra.math.sumAsLong"}, expression = "sumAsLong()")) final static <T extends Number> Mono<Long> sum(Flux<T> \$self)`

Extension to compute the Long sum of all values emitted by a Flux of Number and return it as a Mono of Long.

Note that summing decimal numbers with this method loses precision, see sumDouble.

• #### sum

`@Deprecated(message = "Use sumAll(mapper) instead", replaceWith = @ReplaceWith(imports = {"reactor.kotlin.extra.math.sumAll"}, expression = "sumAll(mapper)")) final static <T extends Any> Mono<Long> sum(Flux<T> \$self, Function1<T, Number> mapper)`

Extension to map arbitrary values in a Flux to Numbers and return the sum of these Numbers as a Mono of Long.

Float and Double are rounded to Long by MathFlux, using Java standard conversions.

Parameters:
`mapper` - a lambda converting values to Number
• #### sumAsInt

` final static <T extends Number> Mono<Integer> sumAsInt(Flux<T> \$self)`

Extension to compute the Int sum of all values emitted by a Flux of Number and return it as a Mono of Int.

Note that numbers will be mapped to Int using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### sumAsLong

` final static <T extends Number> Mono<Long> sumAsLong(Flux<T> \$self)`

Extension to compute the Long sum of all values emitted by a Flux of Number and return it as a Mono of Long.

Note that numbers will be mapped to Long using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### sumAsFloat

` final static <T extends Number> Mono<Float> sumAsFloat(Flux<T> \$self)`

Extension to compute the Float sum of all values emitted by a Flux of Number and return it as a Mono of Float.

Note that numbers will be mapped to Float using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### sumAsDouble

` final static <T extends Number> Mono<Double> sumAsDouble(Flux<T> \$self)`

Extension to compute the Double sum of all values emitted by a Flux of Number and return it as a Mono of Double.

Note that numbers will be mapped to Double using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### sumDouble

`@Deprecated(message = "Use sumAsDouble() instead", replaceWith = @ReplaceWith(imports = {"reactor.kotlin.extra.math.sumAsDouble"}, expression = "sumAsDouble()")) final static <T extends Number> Mono<Double> sumDouble(Flux<T> \$self)`

Extension to compute the Double sum of all values emitted by a Flux of Number and return it as a Mono of Double.

Note that since Double are more precise, some seemingly rounded Floats (e.g. 1.6f) may convert to Doubles with more decimals (eg. 1.600000023841858), producing sometimes unexpected sums.

• #### sumDouble

`@Deprecated(message = "Use sumAll(mapper) instead", replaceWith = @ReplaceWith(imports = {"reactor.kotlin.extra.math.sumAll"}, expression = "sumAll(mapper)")) final static <T extends Any> Mono<Double> sumDouble(Flux<T> \$self, Function1<T, Number> mapper)`

Extension to map arbitrary values in a Flux to Numbers and return the sum of these Numbers as a Mono of Double, thus avoiding rounding down to zero decimal places.

Note that since Double are more precise than Float, some seemingly rounded Floats (e.g. 1.6f) may convert to Doubles with more decimals (eg. 1.600000023841858), producing sometimes unexpected results.

Parameters:
`mapper` - a lambda converting values to Number
• #### sumAsBigInt

` final static <T extends Number> Mono<BigInteger> sumAsBigInt(Flux<T> \$self)`

Extension to compute the BigInteger sum of all values emitted by a Flux of Number and return it as a Mono of BigInteger.

Note that numbers will be mapped to BigInteger using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### sumAsBigDecimal

` final static <T extends Number> Mono<BigDecimal> sumAsBigDecimal(Flux<T> \$self)`

Extension to compute the BigDecimal sum of all values emitted by a Flux of Number and return it as a Mono of BigDecimal.

Note that numbers will be mapped to BigDecimal using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### averageAll

` final static <T extends Number> Mono<T> averageAll(Flux<T> \$self)`

General purpose extension function to compute the average of all values emitted by a Flux of Number and return it as a Mono. The resultant Mono will have the same Number type as the input Flux

If the result type (or precision) needs to be changed then a specific averageAsType() method should be used in preference to this method. e.g. averageAsDouble() can be used to compute the average as a Mono of Double

• #### averageAll

` final static <T extends Any, R extends Number> Mono<R> averageAll(Flux<T> \$self, Function1<T, R> mapper)`

General purpose extension function to map arbitrary values in a Flux to Numbers and return the average of these Numbers as a Mono of Number. The resultant Mono will have the same Number type as the output of the mapping function

If the result type (or precision) needs to be changed then a specific averageAsType() method should be used in preference to this method. e.g. averageAsDouble() can be used to compute the average as a Mono of Double

Parameters:
`mapper` - a lambda converting values to Number
• #### average

`@Deprecated(message = "Use averageAsDouble() instead", replaceWith = @ReplaceWith(imports = {"reactor.kotlin.extra.math.averageAsDouble"}, expression = "averageAsDouble()")) final static <T extends Number> Mono<Double> average(Flux<T> \$self)`

Extension to compute the Double average of all values emitted by a Flux of Number and return it as a Mono of Double.

Note that since Double are more precise, some seemingly rounded Floats (e.g. 1.6f) may convert to Doubles with more decimals (eg. 1.600000023841858), producing sometimes unexpected averages.

• #### average

`@Deprecated(message = "Use averageAll(mapper) instead", replaceWith = @ReplaceWith(imports = {"reactor.kotlin.extra.math.averageAll"}, expression = "averageAll(mapper)")) final static <T extends Any> Mono<Double> average(Flux<T> \$self, Function1<T, Number> mapper)`

Extension to map arbitrary values in a Flux to Numbers and return the average of these Numbers as a Mono of Double.

Note that since Double are more precise than Float, some seemingly rounded Floats (e.g. 1.6f) may convert to Doubles with more decimals (eg. 1.600000023841858), producing sometimes unexpected results.

Parameters:
`mapper` - a lambda converting values to Number
• #### averageAsFloat

` final static <T extends Number> Mono<Float> averageAsFloat(Flux<T> \$self)`

Extension to compute the Float average of all values emitted by a Flux of Number and return it as a Mono of Float.

Note that numbers will be mapped to Float using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### averageAsDouble

` final static <T extends Number> Mono<Double> averageAsDouble(Flux<T> \$self)`

Extension to compute the Double average of all values emitted by a Flux of Number and return it as a Mono of Double.

Note that numbers will be mapped to Double using Java standard conversions This may lead to arbitrary precision gain or loss if the source flux contains different types Please choose an appropriate method based on the expected types in the source flux.

• #### averageAsBigInt

` final static <T extends Number> Mono<BigInteger> averageAsBigInt(Flux<T> \$self)`

Extension to compute the BigInteger average of all values emitted by a Flux of Number and return it as a Mono of BigInteger.

Note that the result will be mapped to BigInteger and is likely to lose precision during the calculation of the average

• #### averageAsBigDecimal

` final static <T extends Number> Mono<BigDecimal> averageAsBigDecimal(Flux<T> \$self)`

Extension to compute the BigDecimal average of all values emitted by a Flux of Number and return it as a Mono of BigDecimal.

• #### min

` final static <T extends Comparable<T>> Mono<T> min(Flux<T> \$self)`

Extension to find the lowest value in a Flux of Comparable values and return it as a Mono of T.

• #### min

` final static <T extends Any> Mono<T> min(Flux<T> \$self, Comparator<T> comp)`

Extension to find the lowest value in a Flux and return it as a Mono. The lowest value is defined by comparisons made using a provided Comparator.

Parameters:
`comp` - The Comparator to use
• #### min

` final static <T extends Any> Mono<T> min(Flux<T> \$self, Function2<T, T, Integer> comp)`

Extension to find the lowest value in a Flux and return it as a Mono. The lowest value is defined by comparisons made using a provided function that behaves like a Comparator.

Parameters:
`comp` - The comparison function to use (similar to a Comparator)
• #### max

` final static <T extends Comparable<T>> Mono<T> max(Flux<T> \$self)`

Extension to find the highest value in a Flux of Comparable values and return it as a Mono of T.

• #### max

` final static <T extends Any> Mono<T> max(Flux<T> \$self, Comparator<T> comp)`

Extension to find the highest value in a Flux and return it as a Mono. The highest value is defined by comparisons made using a provided Comparator.

Parameters:
`comp` - The Comparator to use
• #### max

` final static <T extends Any> Mono<T> max(Flux<T> \$self, Function2<T, T, Integer> comp)`

Extension to find the highest value in a Flux and return it as a Mono. The highest value is defined by comparisons made using a provided function that behaves like a Comparator.

Parameters:
`comp` - The comparison function to use (similar to a Comparator)