@implicitNotFound(msg = "No implicit view available from ${T1} => ${R}.") trait Function1[@specialized -T1, @specialized +R] extends AnyRef
A function of 1 parameter.
In the following example, the definition of succ is a shorthand for the anonymous class definition anonfun1:
object Main extends App {
val succ = (x: Int) => x + 1
val anonfun1 = new Function1[Int, Int] {
def apply(x: Int): Int = x + 1
}
assert(succ(0) == anonfun1(0))
}
Note that the difference between Function1
and scala.PartialFunction
is that the latter can specify inputs which it will not handle.
- Companion
- object
- Source
- Function1.scala
class IntMap[T]
class LongMap[T]
class LongMap[V]
class SystemProperties
trait Seq[A]
class AbstractSeq[A]
class AbstractSeq[A]
class ArraySeq[A]
class ofRef[T]
class ofByte
class ofShort
class ofChar
class ofInt
class ofLong
class ofFloat
class ofDouble
class ofBoolean
class ofUnit
class LazyList[A]
class List[A]
class ::[A]
object Nil
class NumericRange[T]
class Inclusive[T]
class Exclusive[T]
class Queue[A]
class Range
class Inclusive
class Exclusive
class Stream[A]
object Empty
class Cons[A]
class Vector[A]
class WrappedString
class AbstractSeq[A]
class AbstractBuffer[A]
class ArrayBuffer[A]
class ArrayDeque[A]
class Queue[A]
class Stack[A]
class ListBuffer[A]
class UnrolledBuffer[T]
class ArraySeq[T]
class ofRef[T]
class ofByte
class ofShort
class ofChar
class ofInt
class ofLong
class ofFloat
class ofDouble
class ofBoolean
class ofUnit
class StringBuilder
trait IndexedSeq[A]
trait IndexedSeq[A]
trait IndexedSeq[T]
trait IndexedBuffer[A]
trait LinearSeq[A]
trait LinearSeq[A]
trait Seq[A]
trait Seq[A]
trait Buffer[A]
class AnyAccumulator[A]
class DoubleAccumulator
class IntAccumulator
class LongAccumulator
trait Set[A]
class AbstractSet[A]
class AbstractSet[A]
class ValueSet
class BitSet
class BitSet1
class BitSet2
class BitSetN
class HashSet[A]
class ListSet[A]
class ImmutableKeySet
class Set1[A]
class Set2[A]
class Set3[A]
class Set4[A]
class ImmutableKeySortedSet
class TreeSet[A]
class AbstractSet[A]
class BitSet
class HashSet[A]
class LinkedHashSet[A]
class TreeSet[A]
trait SortedSet[A]
trait BitSet
trait SortedSet[A]
trait SortedSet[A]
trait Set[A]
trait Set[A]
trait BitSetOps[C]
class FromJavaConsumer[T]
class FromJavaDoubleConsumer
class FromJavaDoubleFunction[R]
class FromJavaDoublePredicate
class FromJavaIntConsumer
class FromJavaIntFunction[R]
class FromJavaIntPredicate
class FromJavaIntUnaryOperator
class FromJavaLongConsumer
class FromJavaLongFunction[R]
class FromJavaLongPredicate
class FromJavaPredicate[T]
class FromJavaToDoubleFunction[T]
class FromJavaToIntFunction[T]
class FromJavaToLongFunction[T]
class FromJavaUnaryOperator[T]
trait `JFunction1$mcDD$sp`
trait `JFunction1$mcDF$sp`
trait `JFunction1$mcDI$sp`
trait `JFunction1$mcDJ$sp`
trait `JFunction1$mcFD$sp`
trait `JFunction1$mcFF$sp`
trait `JFunction1$mcFI$sp`
trait `JFunction1$mcFJ$sp`
trait `JFunction1$mcID$sp`
trait `JFunction1$mcIF$sp`
trait `JFunction1$mcII$sp`
trait `JFunction1$mcIJ$sp`
trait `JFunction1$mcJD$sp`
trait `JFunction1$mcJF$sp`
trait `JFunction1$mcJI$sp`
trait `JFunction1$mcJJ$sp`
trait `JFunction1$mcVD$sp`
trait `JFunction1$mcVF$sp`
trait `JFunction1$mcVI$sp`
trait `JFunction1$mcVJ$sp`
trait `JFunction1$mcZD$sp`
trait `JFunction1$mcZF$sp`
trait `JFunction1$mcZI$sp`
trait `JFunction1$mcZJ$sp`
Value members
Abstract methods
Apply the body of this function to the argument.
- Returns
the result of function application.
- Source
- Function1.scala
Concrete methods
Composes two instances of Function1 in a new Function1, with this function applied first.
- Type Params
- A
the result type of function
g
- Value Params
- g
a function R => A
- Returns
a new function
f
such thatf(x) == g(apply(x))
- Source
- Function1.scala
Composes two instances of Function1 in a new Function1, with this function applied last.
- Type Params
- A
the type to which function
g
can be applied
- Value Params
- g
a function A => T1
- Returns
a new function
f
such thatf(x) == apply(g(x))
- Source
- Function1.scala