atline atline - 1 year ago 89
Scala Question

What's the difference for Future and future?

Next code are both Ok, why we need the new function future? It seems future just has following signture, anything I miss E.g. for some situation we can just use one of them?

def future[T](body: =>T)(implicit execctx: ExecutionContext): Future[T] = Future[T](body)

Following is the test code:

import scala.concurrent._

Future {

future {


Answer Source

scala.concurrent.future was deprecated in 2.11.0 and will be removed in a future version of Scala, so the answer is you don't need both, and don't use future.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download