abstract fun getOrElse(@Nullable defaultValue: T?): T
Returns success value or in case of failure returns the passed value.
defaultValue
- T?: This value will be returned in case of Failure.
Return
T: Value stored in the Success
or value passed to this method in case of Failure
.
open fun getOrElse(@NonNull provider: (in Throwable!) -> T): T
Returns Success
value or in case of Failure
throws exception that can be built by the given function from the throwable stored in the Failure
.
provider
- (in Throwable!) -> T: function for converting Exception stored in Failure
into the desired value.