The Scala Future API
The Scala Future and Promise API is defined in the scala.concurrent
package. This API is used to develop concurrent and parallel applications in the Scala language.
The Future represents a computation unit; this unit is executed by Promise and put into the Future.
In simple words, Future is an object to read that result and Promise is an object to execute that computation unit. Let's explore these concepts in depth, with some useful examples in the coming sections.
Building blocks of the Scala Future API
The Scala Future API has the following building blocks:
- Scala Future
- Scala Promise
- Scala ExecutionContext
The following diagram shows the main building blocks of the Scala Future API:

These are also known as the main components of the Scala Future API or the three Pillars of the Scala Future API. We will discuss these three Scala Future API components in depth, with some suitable examples in the coming sections.
Benefits of the Scala Future API
The Scala Future API has the following...