fun <reified 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
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
Author
Mark Pruden
Since
1.1.5
inline fun <T : Any, reified 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
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
mapper
- a lambda converting values to Number
Author
Mark Pruden
Since
1.1.5