Scala map isDefinedAt() method with example
The method isDefinedAt() is an abstract value member of trait PartialFunction, which is identical to the method contains and is observed in all the classes of PartialFunction. It inspects whether a value is contained in the function’s domain or not.
- Method Definition:
abstract def isDefinedAt(x: A): Boolean
where, x is the value to be tested.
- Return Type:
It returns true if x is present in the domain of this function else returns false.
Here, the value i.e, x defined above is present in the function domain so, it returns true.
Here, the value i.e, x defined above is not present in the function domain so, it returns false.
My Personal Notes arrow_drop_up
Please Login to comment...