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

orElse

abstract fun orElse(@NonNull defaultTry: Try<T>): Try<T>!

Returns this Try if it's a Success or the given default argument if this is a Failure.

Parameters

defaultTry - Try<T>: This value will be returned in case of Failure.

Return
Try<T>!: This Try if Success, default value otherwise.

abstract fun orElse(@NonNull supplier: Supplier<Try<T>!>): Try<T>!

Returns a Success or a value returned by the Supplier wrapped in a Try.

Parameters

supplier - Supplier<Try<T>!>: value returned by this Supplier will be returned in case of a Failure.

Return
Try<T>!: Success or value returned by Supplier wrapped in a Try otherwise.