sdk-common / com.tomtom.online.sdk.common.functional / Maybe / getOrThrow

getOrThrow

open fun <E : Exception!> getOrThrow(@NonNull exception: Exception): A

Returns Just value or in case of Nothing throws an exception specified as the argument.

Parameters

exception - Exception: exception that should be thrown if the Maybe is expressing the Nothing case.

- type of the exception thrown.

Exceptions

E - exception thrown in case of Nothing

Return
A: value if Just, throws specified exception otherwise.