Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import kotlinx.coroutines.*
  2.  
  3.  
  4. fun run() = runBlocking {
  5. val l: List<Deferred<Int>> = List(100_000) {
  6. async {
  7. delay(1000)
  8. it
  9. }
  10. }
  11. l.map { it -> it.await() }
  12. }
  13.  
  14. fun main(args: Array<String>) {
  15. val l = run()
  16. println("finished running")
  17. l.forEach { print("$it, ") }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement