Created
May 10, 2013 06:04
-
-
Save itszero/5552680 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
// 2.1 Implement buildCar in parallel (orders in parallel) | |
def buildCarPar(): Future[Car] = Future.join( | |
Factory.newChassis(), | |
Factory.newWheels(), | |
Future.join( | |
Factory.newCylinder(), | |
Factory.newPiston() | |
) flatMap { case (cylinder, piston) => buildEngine(cylinder, piston) } | |
) map { case (chassis, wheels, engine) => Car(chassis, wheels, engine) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment