Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Future and future?

Tags:

scala

future

I am new to scala.In Future, I saw it used in two different way i.e Future and future.

Example:

val sayHello = Future {
    Thread.sleep(1000)
    "hello"
  }

Similarly,

val sayHello = future {
    Thread.sleep(1000)
    "hello"
  }

But I didn't find any difference in Output. I will be pleased if anybody

makes it clear to me.

like image 507
M.Regmi Avatar asked Nov 16 '16 10:11

M.Regmi


1 Answers

It is the same thing indeed, and future (lowercase) is actually deprecated since 2.11.0.

See the actual code in scala lang: https://github.com/scala/scala/blob/v2.12.0/src/library/scala/concurrent/package.scala#L101

like image 176
Boris Avatar answered Nov 15 '22 05:11

Boris