Function0

trait Function0[@specialized +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())
}
Source
Function0.scala
class Object
trait Matchable
class Any

Value members

Abstract methods

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.

Source
Function0.scala

Concrete methods

override def toString(): String
Definition Classes
Source
Function0.scala