Skip to content

Instantly share code, notes, and snippets.

@ttldtor
Created March 8, 2015 13:36
Show Gist options
  • Save ttldtor/a2e907ecb8376de366fd to your computer and use it in GitHub Desktop.
Save ttldtor/a2e907ecb8376de366fd to your computer and use it in GitHub Desktop.
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