scala
trait Function0

[source: `scala/Function0.scala`]

`` `trait` Function0[+R]
  `extends` AnyRef

  Function 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())
        }

Direct Known Subclasses:
  Future, Stream.Definite, Reference

Method Summary
`abstract def` | apply : R
`override def` | toString : 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

`abstract` `def` apply : R

`override` `def` toString : String