soMuchToLearnAndShare
soMuchToLearnAndShare

Reputation: 1035

what does optional function mean here?

https://www.scala-lang.org/api/current/scala/Function1.html

it has 'unlift' method, and mentioned optional function. what does it mean "optional function".

Upvotes: 0

Views: 50

Answers (1)

Levi Ramsey
Levi Ramsey

Reputation: 20621

An optional function is a function that returns an Option.

From the docs:

This member is added by an implicit conversion from (T1) => R toUnliftOps[T1, B] performed by method UnliftOps in scala.Function1. This conversion will take place only if R is a subclass of Option[B] (R <: Option[B]).

Upvotes: 4

Related Questions