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 akka.dispatch.Future | |
import akka.actor.ActorSystem | |
object SumApplicationWithFutures extends App { | |
implicit val system = ActorSystem("future") | |
val startTime = System.currentTimeMillis | |
val future1 = Future(timeTakingIdentityFunction(1)) | |
val future2 = Future(timeTakingIdentityFunction(2)) | |
val future3 = Future(timeTakingIdentityFunction(3)) |
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 akka.dispatch.Future | |
import akka.actor.ActorSystem | |
object FutureMonadic extends App { | |
implicit val system = ActorSystem("future") | |
val startTime = System.currentTimeMillis | |
// we construct List[Future[Int]] | |
val futureList = List(1, 2, 3) map { case number => Future(timeTakingIdentityFunction(number)) } | |
val future = Future.sequence(futureList) |