In the previous lesson, you learned the basics of expressing asynchronous computations using the type Future
. In this lesson, you’ll learn how to use the methods map
, flatten
, and flatMap
for an instance of Future
. You’ll notice that they share many commonalities with the map
, flatten
, and flatMap
methods you have mastered for other types. The map
function allows you to transform the value that an asynchronous computation produces. The flatten
method merges two nested instances of Future
into one. The flatMap
operation is the composition of the methods map
and flatten
, and it allows you to chain multiple asynchronous instances. In the capstone, you’ll need to coordinate several asynchronous calls to read or write questions to a database for your quiz application.