Package-level declarations

Types

Link copied to clipboard

Defines how the collect function may run the collector.

Link copied to clipboard
Link copied to clipboard

A Collector accumulates information from elements coming from some data source, usually a kotlinx.coroutines.flow.Flow or Iterable.

Link copied to clipboard
object Collectors

Library of Collectors.

Functions

Link copied to clipboard
Link copied to clipboard
fun <T, R> Iterable<T>.collect(collector: NonSuspendCollector<T, R>): R
fun <T, R> Sequence<T>.collect(collector: NonSuspendCollector<T, R>): R

Performs collection over the elements of this in a non-concurrent fashion.

fun <T, R> Iterator<T>.collect(collector: NonSuspendCollector<T, R>): R

suspend fun <T, R> Flow<T>.collect(collector: Collector<T, R>, concurrency: Int = DEFAULT_CONCURRENCY): R

Performs collection over the elements of this. The amount of concurrency depends on the Characteristics of collector, and can be tweaked using the concurrency parameter.

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 <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
suspend fun <T, R> Iterable<T>.parCollect(collector: Collector<T, R>, concurrency: Int = DEFAULT_CONCURRENCY): R
suspend fun <T, R> Sequence<T>.parCollect(collector: Collector<T, R>, concurrency: Int = DEFAULT_CONCURRENCY): R

Performs collection over the elements of this. The amount of concurrency depends on the Characteristics of collector, and can be tweaked using the concurrency parameter.

Link copied to clipboard
fun <A, R, S, V> zip(x: Collector<A, R>, y: Collector<A, S>, combine: suspend (R, S) -> V): Collector<A, V>

Combines two Collectors by performing the phases of each of them in parallel.

fun <A, R, S, V> zip(x: NonSuspendCollector<A, R>, y: NonSuspendCollector<A, S>, combine: (R, S) -> V): NonSuspendCollector<A, V>

Combines two NonSuspendCollectors by performing the phases of each of them in parallel.

fun <A, R, S, T, V> zip(x: Collector<A, R>, y: Collector<A, S>, z: Collector<A, T>, combine: suspend (R, S, T) -> V): Collector<A, V>

Combines three Collectors by performing the phases of each of them in parallel.

fun <A, R, S, T, V> zip(x: NonSuspendCollector<A, R>, y: NonSuspendCollector<A, S>, z: NonSuspendCollector<A, T>, combine: (R, S, T) -> V): NonSuspendCollector<A, V>

Combines three NonSuspendCollectors by performing the phases of each of them in parallel.