Await Scala Futures

Here’s Scala example code that creates 100 Futures and waits for rolex replica all of them to complete. This is using the swiss replica watches global ExecutionContext.

import scala.concurrent.{Future, Await, future}
import scala.concurrent.duration.Duration
import scala.concurrent.ExecutionContext.Implicits.global

object WaitForAllFutures extends App {

    val futures = (1 to 100).map { i =>
      future {
        Thread.sleep(5000)
        println(s"Future $i done.")
      }
    }

    Await.result(Future.sequence(futures), Duration.Inf)
}

breitling replica