45 Working with Future: For-comprehension and other operations

After reading this lesson, you will be able to

  • Define a chain of asynchronous operations using for-comprehension
  • Select the first Future instance to complete, either successfully or not
  • Find the fastest asynchronous operation to produce a value with specific properties
  • Run independent Future instances in parallel and collect their results in a sequence

You discovered how you can use the map, flatten, and flatMap operations to manipulate the value that asynchronous computations produce. In this lesson, you’ll learn how to coordinate multiple Future instances using for-comprehension. In particular, you’ll see how to provide requirements on when each asynchronous computation should ...

Get Get Programming with Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.