fold

inline fun <R> fold(onSuccess: (value: Success) -> R, onFailure: (exception: Failure) -> R): R

Returns the result of onSuccess for the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated value if it is failure.