sdk-common / com.tomtom.online.sdk.common.functional / Function1 / liftTry

liftTry

open static fun <L : Any!, R : Any!> liftTry(@NonNull partial: (in L) -> out R): ((L) -> Try<R>!)!

Lifts given partial into a total function that returns a Try result.

Parameters

partial - (in L) -> out R: a function that is not defined for all the values of the domain (e.g. it may throw an exception for some values).

- type of the function argument.

- type of the function result.

Return
((L) -> Try<R>!)!: a function that applies arguments to the given partial function and returns Try.Success if the function is defined for the given arguments, and Try.Failure otherwise.