O'Reilly logo

Learning Scala Programming by Vikash Sharma

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Futures

The idea here is simple; we have our simple program flow. If we make some complex time-consuming computation in the main program flow, it'll be blocking and the experience won't be good. Hence, we want to perform that time-consuming computation outside of the basic program flow, and continue doing other stuff in the main program flow, keeping the value (that will be available at a later point in time) of computation. Once the value is available, we use it via a mechanism. The way we can picture this is as follows:

For now, the two entities we can think of are: Futurecomputation and a future value. These two are different; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required