for每个

fun <T> forEach(flow: Flow<T>, action: Consumer<T>)

Passes each element of flow to action as it arrives, blocking until flow completes.


fun <T> forEach(flow: Flow<T>, coroutineContext: CoroutineContext, action: Consumer<T>)

Like forEach, with coroutineContext added to the collection.


fun <T : Any> forEach(publisher: Publisher<T>, action: Consumer<T>)

Passes each element of publisher to action, blocking until publisher completes.