sdk-common / com.tomtom.online.sdk.common.functional / Try / map

map

abstract fun <R : Any!> map(@NonNull function: (in T) -> out R): Try<R>!

Maps success value or passes failure. In case of success function that is passed to this method will be called with the stored value, the result of this operation will be assigned to a new Try. In case of failure map will not invoke the passed function and just pass the failure again.

Parameters

function - (in T) -> out R: Function that is applied to the value stored in the success.

- Type of the resulting Try after mapping.

Return
Try<R>!: Success if the value was mapped, Failure otherwise.