aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2022-08-29 13:27:43 +0300
committerGitHub <noreply@github.com>2022-08-29 13:27:43 +0300
commite68eea63f2affbacf69af041252bad4444fc812f (patch)
tree4acdb606b02d55a738690ff9796386da274fdef2 /core/src/main/kotlin/utilities/parallelCollectionOperations.kt
parent34a8ae166e7220ddf8c3c42fab466234623501e7 (diff)
downloaddokka-e68eea63f2affbacf69af041252bad4444fc812f.tar.gz
dokka-e68eea63f2affbacf69af041252bad4444fc812f.tar.bz2
dokka-e68eea63f2affbacf69af041252bad4444fc812f.zip
Display inherited extensions (#2625)
Diffstat (limited to 'core/src/main/kotlin/utilities/parallelCollectionOperations.kt')
-rw-r--r--core/src/main/kotlin/utilities/parallelCollectionOperations.kt6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/src/main/kotlin/utilities/parallelCollectionOperations.kt b/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
index b3191e8b..35ad48fd 100644
--- a/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
+++ b/core/src/main/kotlin/utilities/parallelCollectionOperations.kt
@@ -1,8 +1,6 @@
package org.jetbrains.dokka.utilities
-import kotlinx.coroutines.async
-import kotlinx.coroutines.awaitAll
-import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.*
suspend inline fun <A, B> Iterable<A>.parallelMap(crossinline f: suspend (A) -> B): List<B> = coroutineScope {
map { async { f(it) } }.awaitAll()
@@ -13,5 +11,5 @@ suspend inline fun <A, B> Iterable<A>.parallelMapNotNull(crossinline f: suspend
}
suspend inline fun <A> Iterable<A>.parallelForEach(crossinline f: suspend (A) -> Unit): Unit = coroutineScope {
- map { async { f(it) } }.awaitAll()
+ forEach { launch { f(it) } }
}