in scala
trait Function0

abstract trait Function0 [R]
extends java.lang.Object
with scala.ScalaObject

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

Def Summary
abstract def apply : R

override def toString : java.lang.String

Def Detail
abstract def apply : R

override def toString : java.lang.String