scala

Function0

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 }

println(currentSeconds()) println(anonfun0()) }

known subclasses: Future, Reference, AbstractFunction0

Inherits

  1. AnyRef
  2. Any

Value Members

  1. def apply(): R

  2. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

  3. def hashCode(): Int

    Returns a hash code value for the object

  4. def toString(): String

    Returns a string representation of the object