Skip to content

Instantly share code, notes, and snippets.

Created January 25, 2017 14:57
Show Gist options
  • Save anonymous/328c219dedeb20210521899ea5c153ea to your computer and use it in GitHub Desktop.
Save anonymous/328c219dedeb20210521899ea5c153ea to your computer and use it in GitHub Desktop.
import kotlinx.coroutines.experimental.future.await
import kotlinx.coroutines.experimental.future.future
import java.util.concurrent.CompletableFuture
fun main(args: Array<String>) {
val f : CompletableFuture<String> = future {
(1..5).map {
startLongAsyncOperation(it).await()
}.joinToString("\n")
}
println(f.get())
}
fun startLongAsyncOperation(num: Int): CompletableFuture<Int> = future {
42
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment