in scala
trait Function1

abstract trait Function1 [T1, R]
extends java.lang.Object
with scala.ScalaObject

Function with 1 parameters.

In the following example the definition of succ is a shorthand for the anonymous class definition anonfun1:

  object Main extends Application {

    val succ = (x: Int) => x + 1

    val anonfun1 = new Function1[Int, Int] {
      def apply(x: Int): Int = x + 1
    }

    Console.println(succ(0))
    Console.println(anonfun1(0))
  }
Direct Known Subclasses:
BasicTransformer, ElementValidator, Print, Chan, Set, PartialFunction

Def Summary
def andThen [A] (g: (R) => A) : (T1) => A
(f andThen g)(x) = g(f(x))
abstract def apply (v1: T1) : R

def compose [A] (g: (A) => T1) : (A) => R
(f compose g)(x) = f(g(x))
override def toString : java.lang.String

Def Detail
def andThen [A](g: (R) => A): (T1) => A
(f andThen g)(x) = g(f(x))

abstract def apply (v1: T1): R

def compose [A](g: (A) => T1): (A) => R
(f compose g)(x) = f(g(x))

override def toString : java.lang.String