parallel Map Then
inline fun <S, T> Collection<S>.parallelMapThen(crossinline action: (S, (T) -> Unit) -> Unit, crossinline then: (List<T>) -> Unit)
Content copied to clipboard
For each element in the collection, execute the action, passing a zero-argument function to run exactly once afterward (in this Thread or another). When the last element's zero-argument function has been invoked, or immediately if the collection is empty, invoke then.
Parameters
action
What to do with each element. It should invoke the second argument when processing of that element is considered complete.
then
What to do after each element has reported completion.
S
The source element type.
T
The target element type, produced by the action.