Package reactor.kotlin.extra.math

Functions

Link copied to clipboard
fun <T : Number> Flux<T>.average(): Mono<Double>

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

fun <T> Flux<T>.average(mapper: (T) -> Number): Mono<Double>

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

Link copied to clipboard
inline fun <T : Number> Flux<T>.averageAll(): Mono<T>

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

inline fun <T : Any, R : Number> Flux<T>.averageAll(noinline mapper: (T) -> R): Mono<R>

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

Link copied to clipboard
fun <T : Number> Flux<T>.averageAsBigDecimal(): Mono<BigDecimal>

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

Link copied to clipboard
fun <T : Number> Flux<T>.averageAsBigInt(): Mono<BigInteger>

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

Link copied to clipboard
fun <T : Number> Flux<T>.averageAsDouble(): Mono<Double>

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

Link copied to clipboard
fun <T : Number> Flux<T>.averageAsFloat(): Mono<Float>

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

Link copied to clipboard
fun <T : Comparable<T>> Flux<T>.max(): Mono<T>

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

fun <T> Flux<T>.max(comp: Comparator<T>): Mono<T>

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.

fun <T> Flux<T>.max(comp: (T, T) -> Int): Mono<T>

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.

Link copied to clipboard
fun <T : Comparable<T>> Flux<T>.min(): Mono<T>

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

fun <T> Flux<T>.min(comp: Comparator<T>): Mono<T>

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.

fun <T> Flux<T>.min(comp: (T, T) -> Int): Mono<T>

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.

Link copied to clipboard
fun <T : Number> Flux<T>.sum(): Mono<Long>

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

fun <T> Flux<T>.sum(mapper: (T) -> Number): Mono<Long>

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

Link copied to clipboard
inline fun <T : Number> Flux<T>.sumAll(): Mono<T>

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

inline fun <T : Any, R : Number> Flux<T>.sumAll(noinline mapper: (T) -> R): Mono<R>

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

Link copied to clipboard
fun <T : Number> Flux<T>.sumAsBigDecimal(): Mono<BigDecimal>

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

Link copied to clipboard
fun <T : Number> Flux<T>.sumAsBigInt(): Mono<BigInteger>

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

Link copied to clipboard
fun <T : Number> Flux<T>.sumAsDouble(): Mono<Double>

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

Link copied to clipboard
fun <T : Number> Flux<T>.sumAsFloat(): Mono<Float>

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

Link copied to clipboard
fun <T : Number> Flux<T>.sumAsInt(): Mono<Int>

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

Link copied to clipboard
fun <T : Number> Flux<T>.sumAsLong(): Mono<Long>

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

Link copied to clipboard
fun <T : Number> Flux<T>.sumDouble(): Mono<Double>

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

fun <T> Flux<T>.sumDouble(mapper: (T) -> Number): Mono<Double>

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.