Created
March 8, 2015 13:36
-
-
Save ttldtor/a2e907ecb8376de366fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
object Main extends App { | |
val futures = 1 to 1000 map { i => Future { i } } | |
val seq = Future.sequence(futures) | |
seq.onSuccess { case i => println(i) } | |
// just because ideone will kill main thread otherwise | |
Await.result(seq, Duration(100, "seconds")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment