Quantcast
Channel: Scala map over a Future - Stack Overflow
Browsing index pages (2 articles)

Scala map over a Future

In the following example, what is the expected behaviour?import scala.concurrent.ExecutionContext.Implicits.globalval someFuture = Future { 1+1 }.map(elem => { println("mapping immediately")...

View Article


Answer by tharindu_DG for Scala map over a Future

It depends.val someFuture = Future { 1+1 }.map(elem => { println("mapping immediately") elem.toString})someFuture will be executed eagerly and the println will be executed.someFuture.onComplete {...

View Article

Browsing index pages (2 articles)


Latest Images