Future 和 Future 和有什么不一样?
What is the difference between Future and future?
我是 scala.In Future 的新手,我看到它以两种不同的方式使用,即 Future 和 future。
示例:
val sayHello = Future {
Thread.sleep(1000)
"hello"
}
同样,
val sayHello = future {
Thread.sleep(1000)
"hello"
}
但我没有发现输出有任何差异。如果有人我会很高兴
让我明白了。
确实是一回事,future(小写)实际上从 2.11.0 开始就被弃用了。
查看scala lang中的实际代码:https://github.com/scala/scala/blob/v2.12.0/src/library/scala/concurrent/package.scala#L101
我是 scala.In Future 的新手,我看到它以两种不同的方式使用,即 Future 和 future。
示例:
val sayHello = Future {
Thread.sleep(1000)
"hello"
}
同样,
val sayHello = future {
Thread.sleep(1000)
"hello"
}
但我没有发现输出有任何差异。如果有人我会很高兴
让我明白了。
确实是一回事,future(小写)实际上从 2.11.0 开始就被弃用了。
查看scala lang中的实际代码:https://github.com/scala/scala/blob/v2.12.0/src/library/scala/concurrent/package.scala#L101