Function2
A function of 2 parameters.
In the following example, the definition of max is a shorthand for the anonymous class definition anonfun2:
object Main extends App {
val max = (x: Int, y: Int) => if (x < y) y else x
val anonfun2 = new Function2[Int, Int, Int] {
def apply(x: Int, y: Int): Int = if (x < y) y else x
}
assert(max(0, 1) == anonfun2(0, 1))
}
- Source:
- Function2.scala
class FromJavaBinaryOperator[T]
class FromJavaObjDoubleConsumer[T]
class FromJavaObjIntConsumer[T]
class FromJavaObjLongConsumer[T]
trait JFunction2$mcDDD$sp
trait JFunction2$mcDDI$sp
trait JFunction2$mcDDJ$sp
trait JFunction2$mcDID$sp
trait JFunction2$mcDII$sp
trait JFunction2$mcDIJ$sp
trait JFunction2$mcDJD$sp
trait JFunction2$mcDJI$sp
trait JFunction2$mcDJJ$sp
trait JFunction2$mcFDD$sp
trait JFunction2$mcFDI$sp
trait JFunction2$mcFDJ$sp
trait JFunction2$mcFID$sp
trait JFunction2$mcFII$sp
trait JFunction2$mcFIJ$sp
trait JFunction2$mcFJD$sp
trait JFunction2$mcFJI$sp
trait JFunction2$mcFJJ$sp
trait JFunction2$mcIDD$sp
trait JFunction2$mcIDI$sp
trait JFunction2$mcIDJ$sp
trait JFunction2$mcIID$sp
trait JFunction2$mcIII$sp
trait JFunction2$mcIIJ$sp
trait JFunction2$mcIJD$sp
trait JFunction2$mcIJI$sp
trait JFunction2$mcIJJ$sp
trait JFunction2$mcJDD$sp
trait JFunction2$mcJDI$sp
trait JFunction2$mcJDJ$sp
trait JFunction2$mcJID$sp
trait JFunction2$mcJII$sp
trait JFunction2$mcJIJ$sp
trait JFunction2$mcJJD$sp
trait JFunction2$mcJJI$sp
trait JFunction2$mcJJJ$sp
trait JFunction2$mcVDD$sp
trait JFunction2$mcVDI$sp
trait JFunction2$mcVDJ$sp
trait JFunction2$mcVID$sp
trait JFunction2$mcVII$sp
trait JFunction2$mcVIJ$sp
trait JFunction2$mcVJD$sp
trait JFunction2$mcVJI$sp
trait JFunction2$mcVJJ$sp
trait JFunction2$mcZDD$sp
trait JFunction2$mcZDI$sp
trait JFunction2$mcZDJ$sp
trait JFunction2$mcZID$sp
trait JFunction2$mcZII$sp
trait JFunction2$mcZIJ$sp
trait JFunction2$mcZJD$sp
trait JFunction2$mcZJI$sp
trait JFunction2$mcZJJ$sp
Value members
Abstract methods
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:
- Function2.scala
Concrete methods
Creates a curried version of this function.
Creates a curried version of this function.
- Returns:
a function
f
such thatf(x1)(x2) == apply(x1, x2)
- Source:
- Function2.scala
Creates a tupled version of this function: instead of 2 arguments, it accepts a single scala.Tuple2 argument.
Creates a tupled version of this function: instead of 2 arguments, it accepts a single scala.Tuple2 argument.
- Returns:
a function
f
such thatf((x1, x2)) == f(Tuple2(x1, x2)) == apply(x1, x2)
- Source:
- Function2.scala