Also note that the collections library was carefully designed to include several implementations of
each of the three basic collection types. These implementations have specific performance
characteristics which are described
in the guide.

This allows the caller of the method, or creator of the instance of the class, to decide which
ExecutionContext should be used.

For typical REPL usage and experimentation, importing the global ExecutionContext is often desired.

import scala.concurrent.ExcutionContext.Implicits.global

Specifying Durations

Operations often require a duration to be specified. A duration DSL is available
to make defining these easier:

import scala.concurrent.duration._
val d: Duration = 10.seconds

Using Futures For Non-blocking Computation

Basic use of futures is easy with the factory method on Future, which executes a
provided function asynchronously, handing you back a future result of that function
without blocking the current thread. In order to create the Future you will need
either an implicit or explicit ExecutionContext to be provided:

Avoid Blocking

and although this is sometimes necessary to do, in particular for testing purposes, blocking
in general is discouraged when working with Futures and concurrency in order to avoid
potential deadlocks and improve performance. Instead, use callbacks or combinators to
remain in the future domain: