maybe
Wraps a value of type Ok as a Maybe based on a isSuccess.
If the isSuccess returns true
, the value is wrapped as a Success. If the isSuccess returns false
, an emptyFailure is returned.
Return
A Maybe containing the value as a Success or an emptyFailure.
Parameters
Ok
The type of the value to wrap.
is Success
A function that determines if the value is successful.
Throwable and
null
are wrapped as a emptyFailure.Otherwise, the value is wrapped as a Success.
Return
An Maybe containing the value as a Success or an emptyFailure.
Parameters
T
The type of the value to wrap.