parCollect

suspend fun <T, R> Iterable<T>.parCollect(collector: Collector<T, R>, concurrency: Int = DEFAULT_CONCURRENCY): R(source)

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.

this is iterated only once during collection.

Note: if you need to perform changes on the values before collection, we strongly recommend to convert the Iterable into a Flow using asFlow, perform those changes, and then using collect.

Receiver

Sequence of values to collect

Parameters

collector

Describes how to collect the values

concurrency

Defines the concurrency limit


suspend fun <T, R> Sequence<T>.parCollect(collector: Collector<T, R>, concurrency: Int = DEFAULT_CONCURRENCY): R(source)

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.

this is iterated only once during collection.

Note: if you need to perform changes on the values before collection, we strongly recommend to convert the Sequence into a Flow using asFlow, perform those changes, and then using collect.

Receiver

Sequence of values to collect

Parameters

collector

Describes how to collect the values

concurrency

Defines the concurrency limit