import scala concurrent Future import scala concurrent import scala co

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import scala.concurrent.Future
import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
object HelloWorld {
def main(args: Array[String]): Unit = {
var futures = for (i <- 2 to 1 by -1) yield Future {
val r = requests.get("http://httpbin.org/get", readTimeout = 10)
r.text
}
println(futures.map(Await.result(_, Duration.Inf)))
}
}