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

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

fun <T, R> Iterator<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.

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

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.

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.

fun <A, C1, C2, C3, C4, R> zip(c1: Collector<A, C1>, c2: Collector<A, C2>, c3: Collector<A, C3>, c4: Collector<A, C4>, combine: suspend (C1, C2, C3, C4) -> R): Collector<A, R>

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

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

fun <A, C1, C2, C3, C4, C5, R> zip(c1: Collector<A, C1>, c2: Collector<A, C2>, c3: Collector<A, C3>, c4: Collector<A, C4>, c5: Collector<A, C5>, combine: suspend (C1, C2, C3, C4, C5) -> R): Collector<A, R>

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