reactor-kotlin-extensions / reactor.kotlin.extra.math / reactor.core.publisher.Flux

Extensions for reactor.core.publisher.Flux

average

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 : Number> Flux<T>.average(): Mono<Double>

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

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

averageAll

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

fun <T : Number> Flux<T>.averageAll(): Mono<T>

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

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

averageAsBigDecimal

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

fun <T : Number> Flux<T>.averageAsBigDecimal(): Mono<BigDecimal>

averageAsBigInt

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

fun <T : Number> Flux<T>.averageAsBigInt(): Mono<BigInteger>

averageAsDouble

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 : Number> Flux<T>.averageAsDouble(): Mono<Double>

averageAsFloat

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

fun <T : Number> Flux<T>.averageAsFloat(): Mono<Float>

max

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

fun <T : Comparable<T>> Flux<T>.max(): 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: 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 function that behaves like a Comparator.

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

min

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

fun <T : Comparable<T>> Flux<T>.min(): 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: 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 function that behaves like a Comparator.

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

sum

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 : Number> Flux<T>.sum(): Mono<Long>

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

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

sumAll

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

fun <T : Number> Flux<T>.sumAll(): Mono<T>

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

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

sumAsBigDecimal

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

fun <T : Number> Flux<T>.sumAsBigDecimal(): Mono<BigDecimal>

sumAsBigInt

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

fun <T : Number> Flux<T>.sumAsBigInt(): Mono<BigInteger>

sumAsDouble

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 : Number> Flux<T>.sumAsDouble(): Mono<Float>

sumAsFloat

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

fun <T : Number> Flux<T>.sumAsFloat(): Mono<Float>

sumAsInt

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

fun <T : Number> Flux<T>.sumAsInt(): Mono<Int>

sumAsLong

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 : Number> Flux<T>.sumAsLong(): Mono<Long>

sumDouble

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 : Number> Flux<T>.sumDouble(): 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.

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