I am looking at the PartialFunction
source code of Scala. In the file, the trait PartialFunction
as well as a companion object PartialFunction
are defined. The companion object has methods cond
and condOpt
.
Link: https://github.com/othiym23/scala/blob/master/src/library/scala/PartialFunction.scala
When I look into andThen
as well orElse
function, the below method calls are present.
1. PartialFunction.this.isDefinedAt(x)
2. PartialFunction.this.apply(x)
I am not sure from where these functions (isDefinedAt / apply) are present.
Can someone please help where these two methods are present.
Thanks!
I guess it's
Function1
since PartialFunction extendsA => B
https://github.com/othiym23/scala/blob/master/src/library/scala/Function1.scala