Scala Library Documentation
|
|
scala/Function0.scala
]
trait
Function0[+R]
extends
AnyRefFunction with 0 parameters.
In the following example the definition of
currentSeconds
is a shorthand for the anonymous class
definition anonfun0
:
object Main extends Application { val currentSeconds = () => System.currentTimeMillis() / 1000L val anonfun0 = new Function0[Long] { def apply(): Long = System.currentTimeMillis() / 1000L } Console.println(currentSeconds()) Console.println(anonfun0()) }
Method Summary | |
abstract def
|
apply : R |
override def
|
toString : java.lang.String |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
Scala Library Documentation
|
|