parallelForEach

suspend fun <T> Iterable<T>.parallelForEach(concurrency: Int = Int.MAX_VALUE, action: suspend (T) -> Unit)

Like forEach, but runs action for many elements at the same time. Returns when all are done.

staleEntries.parallelForEach(concurrency = 16) { cache.evict(it) }

The rules for the limit, failures, cancellation and the copy of the elements are the same as for parallelMap.

Parameters

concurrency

the largest number of calls that run at the same time. At least 1. The default, Int.MAX_VALUE, means no limit.

Throws