Collectors

Library of Collectors.

Properties

Link copied to clipboard

Counts the number of elements in the flow.

Link copied to clipboard

Sum of all the values in the flow.

Functions

Link copied to clipboard
fun <M> bestBy(selectNew: (old: M, new: M) -> Boolean): NonSuspendCollector<M, M?>

Returns the "best" value from the value.

Link copied to clipboard

Collects all the values in a map.

Link copied to clipboard

Collects all the values in a map.

Link copied to clipboard

Collects all the values in a set.

Link copied to clipboard
fun <R> constant(value: R): NonSuspendCollector<Any?, R>

Returns always the same value, regardless of the collected flow.

Link copied to clipboard
fun intReducer(initial: () -> Int, combine: (Int, Int) -> Int): NonSuspendCollector<Int, Int>
Link copied to clipboard
fun <T, R> Collectors.jvm(collector: Collector<T, *, R>): NonSuspendCollector<T, R>

Wraps a java.util.stream.Collector to use with collect.

Link copied to clipboard

Collects all the values in a list, in the order in which they are emitted.

Link copied to clipboard
fun <K, V> map(): NonSuspendCollector<Pair<K, V>, Map<K, V>>

Collects all the values in a map.

Link copied to clipboard

Collects all the values in a map.

Link copied to clipboard
fun <M> reducer(initial: () -> M, combine: (M, M) -> M, unordered: Boolean = false): NonSuspendCollector<M, M>
Link copied to clipboard

Collects all the values in a set.