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

ofChecked

@NonNull open static fun <R : Any!> ofChecked(@NonNull supplier: CheckedSupplier<out R>): Try<R>

Creates a Try from a given CheckedSupplier. The code run by the supplier can throw an Exception, this exception will be caught and wrapped by the resulting Try.

Parameters

supplier - CheckedSupplier<out R>: creates a value that will be wrapped in Try.

- type of the value returned by the CheckedSupplier.

Return
Try<R>: Success if a value is returned from the given CheckedSupplier, Failure otherwise.