Packages

t

scala

Function0

trait Function0[+R] extends AnyRef

A function of 0 parameters.

In the following example, the definition of javaVersion is a shorthand for the anonymous class definition anonfun0:

 object Main extends App {
   val javaVersion = () => sys.props("java.version")

   val anonfun0 = new Function0[String] {
     def apply(): String = sys.props("java.version")
   }
   assert(javaVersion() == anonfun0())
}
Self Type
() => R
Source
Function0.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Function0
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def apply(): R

    Apply the body of this function to the arguments.

    Apply the body of this function to the arguments.

    returns

    the result of function application.

Concrete Value Members

  1. def toString(): String

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

    a String representation of the object.

    Definition Classes
    Function0 → AnyRef → Any