V
- type of returned valueE
- type of errors.public class Result<V,E>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <V,E> Result<V,E> |
failure(E error) |
E |
getError() |
V |
getValue() |
boolean |
isFailure()
Returns true if result has no value and false otherwise
|
boolean |
isSuccess()
Returns true if result has the value and false otherwise
|
static <V,E> Result<V,E> |
success(V value) |
public static <V,E> Result<V,E> success(@NonNull V value)
public static <V,E> Result<V,E> failure(@NonNull E error)
@NonNull public V getValue() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if operation failed@NonNull public E getError() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if operation was successful.public boolean isSuccess()
public boolean isFailure()