sumDouble

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.

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.

Author

Simon Baslé

Since

1.0.0


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.

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.

Author

Simon Baslé

Since

1.0.0

Parameters

mapper

a lambda converting values to Number