| Modifier and Type | Method and Description |
|---|---|
<R> Result<R,?> |
andThen(ThrowingConsumer<T> op)
If the current value is OK, pass it to a consumer and return an empty OK result.
|
<R> Result<R,?> |
andThen(ThrowingRunnable op)
If the current value is OK, call a runnable and return an empty OK result.
|
<R> Result<R,?> |
andThen(ThrowingSupplier<Result<R,?>> op)
If the current value is OK, yield a new Result by calling a supplier.
|
Result<?,?> |
andThenTry(ThrowingConsumer<T> op)
If the current value is OK, pass it to a consumer and return an empty OK result.
|
<R> Result<R,?> |
andThenTry(ThrowingRunnable op)
If the current value is OK, call a runnable and return an empty OK result.
|
<R> Result<R,?> |
andThenTry(ThrowingSupplier<R> op)
If the current value is OK, yield a new Result by calling a supplier.
|
static <T,E extends Throwable> |
err(E error) |
T |
get() |
E |
getError() |
T |
getUnsafe() |
boolean |
isOk() |
<R> Result<R,?> |
map(ThrowingFunction<T,Result<R,?>> op)
If the current value is OK, transform it into a new Result by applying a function.
|
Result<T,?> |
mapErr(ThrowingFunction<E,Result<T,?>> op) |
static <T> Result<T,?> |
ok() |
static <T> Result<T,?> |
ok(T value) |
Result<T,?> |
orElse(T defaultValue)
If the current value is an error, transform it into a default value.
|
Result<T,?> |
orElse(ThrowingConsumer<E> op) |
Result<T,?> |
orElse(ThrowingRunnable op) |
Result<T,?> |
orElse(ThrowingSupplier<Result<T,?>> op) |
Result<T,?> |
orElseTry(ThrowingConsumer<E> op) |
Result<T,?> |
orElseTry(ThrowingRunnable op) |
Result<T,?> |
orElseTry(ThrowingSupplier<T> op) |
static <T> Result<T,?> |
trying(ThrowingRunnable op) |
static <T> Result<T,?> |
trying(ThrowingSupplier<T> op) |
<R> Result<R,?> |
tryMap(ThrowingFunction<T,R> op)
If the current value is OK, transform it into a new Result by applying a function.
|
Result<T,?> |
tryMapErr(ThrowingFunction<E,T> op) |
public <R> Result<R,?> map(@NonNull ThrowingFunction<T,Result<R,?>> op)
op - the function to apply, should return a Result objectRuntimeException - if the mapping function throwspublic <R> Result<R,?> tryMap(@NonNull ThrowingFunction<T,R> op)
op - the function to apply, should return the raw value that will be automatically wrappedpublic <R> Result<R,?> andThen(@NonNull ThrowingSupplier<Result<R,?>> op)
op - the supplier to call, should return a Result objectRuntimeException - if the supplier throwspublic <R> Result<R,?> andThenTry(@NonNull ThrowingSupplier<R> op)
op - the supplier to call, should return a Result objectpublic <R> Result<R,?> andThen(@NonNull ThrowingConsumer<T> op)
op - the consumer to callRuntimeException - if the consumer throwspublic Result<?,?> andThenTry(@NonNull ThrowingConsumer<T> op)
op - the consumer to callpublic <R> Result<R,?> andThen(@NonNull ThrowingRunnable op)
op - the runnable to runRuntimeException - if the runnable throwspublic <R> Result<R,?> andThenTry(@NonNull ThrowingRunnable op)
op - the runnable to runRuntimeException - if the runnable throwspublic Result<T,?> orElse(T defaultValue)
defaultValue - the default valuepublic Result<T,?> tryMapErr(@NonNull ThrowingFunction<E,T> op)
public Result<T,?> orElse(@NonNull ThrowingSupplier<Result<T,?>> op)
public Result<T,?> orElseTry(@NonNull ThrowingSupplier<T> op)
public Result<T,?> orElse(@NonNull ThrowingConsumer<E> op)
public Result<T,?> orElseTry(@NonNull ThrowingConsumer<E> op)
public Result<T,?> orElse(@NonNull ThrowingRunnable op)
public Result<T,?> orElseTry(@NonNull ThrowingRunnable op)
public T getUnsafe()
public E getError()
public static <T> Result<T,?> ok()
public static <T> Result<T,?> trying(@NonNull ThrowingSupplier<T> op)
public static <T> Result<T,?> trying(@NonNull ThrowingRunnable op)
public boolean isOk()
public static <T> Result<T,?> ok(T value)
Copyright © 2017. All rights reserved.