scala.Function1
See theFunction1 companion object
A function of 1 parameter.
In the following example, the definition of succ
is shorthand, conceptually, for the anonymous class definition anonfun1
, although the implementation details of how the function value is constructed may differ:
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.
Attributes
- Companion
- object
- Source
- Function1.scala
- Graph
-
- Supertypes
- Known subtypes
-
trait Set[A]class AbstractSet[A]class BitSetclass BitSet1class BitSet2class BitSetNclass HashSet[A]class ListSet[A]class Set1[A]class Set2[A]class Set3[A]class Set4[A]class ImmutableKeySortedSetclass TreeSet[A]class ValueSettrait SortedSet[A]class HashSet[A]class LinkedHashSet[A]trait Set[A]class AbstractSet[A]class BitSetclass TreeSet[A]trait SortedSet[A]trait Set[A]class AbstractSet[A]trait SortedSet[A]trait BitSettrait BitSetOps[C]class FromJavaConsumer[T]class FromJavaDoubleConsumerclass FromJavaDoubleFunction[R]class FromJavaDoublePredicateclass FromJavaIntConsumerclass FromJavaIntFunction[R]class FromJavaIntPredicateclass FromJavaIntUnaryOperatorclass FromJavaLongConsumerclass FromJavaLongFunction[R]class FromJavaLongPredicateclass FromJavaPredicate[T]class FromJavaToDoubleFunction[T]class FromJavaToIntFunction[T]class FromJavaToLongFunction[T]class FromJavaUnaryOperator[T]trait JFunction1$mcDD$sptrait JFunction1$mcDF$sptrait JFunction1$mcDI$sptrait JFunction1$mcDJ$sptrait JFunction1$mcFD$sptrait JFunction1$mcFF$sptrait JFunction1$mcFI$sptrait JFunction1$mcFJ$sptrait JFunction1$mcID$sptrait JFunction1$mcIF$sptrait JFunction1$mcII$sptrait JFunction1$mcIJ$sptrait JFunction1$mcJD$sptrait JFunction1$mcJF$sptrait JFunction1$mcJI$sptrait JFunction1$mcJJ$sptrait JFunction1$mcVD$sptrait JFunction1$mcVF$sptrait JFunction1$mcVI$sptrait JFunction1$mcVJ$sptrait JFunction1$mcZD$sptrait JFunction1$mcZF$sptrait JFunction1$mcZI$sptrait JFunction1$mcZJ$spclass IntMap[T]class LongMap[T]class LongMap[V]class SystemPropertiestrait Seq[A]trait Seq[A]class AbstractSeq[A]class ArraySeq[A]class ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass LazyList[A]class List[A]class ::[A]object Nilclass NumericRange[T]class Exclusive[T]class Inclusive[T]class Queue[A]class Rangeclass Exclusiveclass Inclusiveclass Stream[A]class Cons[A]object Emptyclass Vector[A]class WrappedStringtrait IndexedSeq[A]trait LinearSeq[A]trait Seq[A]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 ofBooleanclass ofByteclass ofCharclass ofDoubleclass ofFloatclass ofIntclass ofLongclass ofRef[T]class ofShortclass ofUnitclass StringBuildertrait Buffer[A]trait IndexedBuffer[A]trait IndexedSeq[T]class AnyAccumulator[A]class DoubleAccumulatorclass IntAccumulatorclass LongAccumulatorclass AbstractSeq[A]trait IndexedSeq[A]trait LinearSeq[A]
- Self type
-
T1 => R
Members list
In this article