collect
suspend fun <T, R> Flow<T>.collect(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 consumed only once during collection. We recommend using a cold Flow to ensure that elements are produced only when needed.
Receiver
Flow of elements to collect
Parameters
collector
Describes how to collect the values
concurrency
Defines the concurrency limit
Performs collection over the elements of this in a non-concurrent fashion.
this is iterated only once during collection.
Receiver
Sequence of values to collect
Parameters
collector
Describes how to collect the values