| Package | Description |
|---|---|
| io.vavr |
Beside
API the io.vavr package contains core types like (Checked)Functions and Tuples. |
| io.vavr.concurrent |
This package contains basic building blocks for creating fast, asynchronous, non-blocking parallel code.
|
| io.vavr.control |
| Modifier and Type | Method and Description |
|---|---|
static <T,_1 extends Option<Try<T>>> |
Patterns.$Future(API.Match.Pattern<_1,?> p1) |
| Modifier and Type | Method and Description |
|---|---|
default Try<T> |
Value.toTry()
Converts this to a
Try. |
default Try<T> |
Value.toTry(Supplier<? extends Throwable> ifEmpty)
Converts this to a
Try. |
static <T> Try<T> |
API.Try(CheckedFunction0<? extends T> supplier)
Alias for
of(CheckedFunction0) |
Try<T1> |
API.For1Try.yield()
A shortcut for
yield(Function.identity()). |
<R> Try<R> |
API.For2Try.yield(BiFunction<? super T1,? super T2,? extends R> f)
Yields a result for elements of the cross product of the underlying Trys.
|
<R> Try<R> |
API.For1Try.yield(Function<? super T1,? extends R> f)
Yields a result for elements of the cross product of the underlying Try.
|
<R> Try<R> |
API.For3Try.yield(Function3<? super T1,? super T2,? super T3,? extends R> f)
Yields a result for elements of the cross product of the underlying Trys.
|
<R> Try<R> |
API.For4Try.yield(Function4<? super T1,? super T2,? super T3,? super T4,? extends R> f)
Yields a result for elements of the cross product of the underlying Trys.
|
<R> Try<R> |
API.For5Try.yield(Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> f)
Yields a result for elements of the cross product of the underlying Trys.
|
<R> Try<R> |
API.For6Try.yield(Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> f)
Yields a result for elements of the cross product of the underlying Trys.
|
<R> Try<R> |
API.For7Try.yield(Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> f)
Yields a result for elements of the cross product of the underlying Trys.
|
<R> Try<R> |
API.For8Try.yield(Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> f)
Yields a result for elements of the cross product of the underlying Trys.
|
| Modifier and Type | Method and Description |
|---|---|
static <T1,T2,R> Function2<T1,T2,Try<R>> |
Function2.liftTry(BiFunction<? super T1,? super T2,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <R> Function0<Try<R>> |
CheckedFunction0.liftTry(CheckedFunction0<? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,R> Function1<T1,Try<R>> |
CheckedFunction1.liftTry(CheckedFunction1<? super T1,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,R> Function2<T1,T2,Try<R>> |
CheckedFunction2.liftTry(CheckedFunction2<? super T1,? super T2,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,R> |
CheckedFunction3.liftTry(CheckedFunction3<? super T1,? super T2,? super T3,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,R> |
CheckedFunction4.liftTry(CheckedFunction4<? super T1,? super T2,? super T3,? super T4,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,R> |
CheckedFunction5.liftTry(CheckedFunction5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,T6,R> |
CheckedFunction6.liftTry(CheckedFunction6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,T6,T7,R> |
CheckedFunction7.liftTry(CheckedFunction7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
CheckedFunction8.liftTry(CheckedFunction8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,R> Function1<T1,Try<R>> |
Function1.liftTry(Function<? super T1,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,R> |
Function3.liftTry(Function3<? super T1,? super T2,? super T3,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,R> |
Function4.liftTry(Function4<? super T1,? super T2,? super T3,? super T4,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,R> |
Function5.liftTry(Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,T6,R> |
Function6.liftTry(Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,T6,T7,R> |
Function7.liftTry(Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
Function8.liftTry(Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
static <R> Function0<Try<R>> |
Function0.liftTry(Supplier<? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Try result. |
| Modifier and Type | Method and Description |
|---|---|
static <T1> API.For1Try<T1> |
API.For(Try<T1> ts1)
Creates a
For-comprehension of one Try. |
static <T1,T2> API.For2Try<T1,T2> |
API.For(Try<T1> ts1,
Try<T2> ts2)
Creates a
For-comprehension of two Trys. |
static <T1,T2> API.For2Try<T1,T2> |
API.For(Try<T1> ts1,
Try<T2> ts2)
Creates a
For-comprehension of two Trys. |
static <T1,T2,T3> API.For3Try<T1,T2,T3> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3)
Creates a
For-comprehension of three Trys. |
static <T1,T2,T3> API.For3Try<T1,T2,T3> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3)
Creates a
For-comprehension of three Trys. |
static <T1,T2,T3> API.For3Try<T1,T2,T3> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3)
Creates a
For-comprehension of three Trys. |
static <T1,T2,T3,T4> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4)
Creates a
For-comprehension of 4 Trys. |
static <T1,T2,T3,T4> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4)
Creates a
For-comprehension of 4 Trys. |
static <T1,T2,T3,T4> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4)
Creates a
For-comprehension of 4 Trys. |
static <T1,T2,T3,T4> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4)
Creates a
For-comprehension of 4 Trys. |
static <T1,T2,T3,T4,T5> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5)
Creates a
For-comprehension of 5 Trys. |
static <T1,T2,T3,T4,T5> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5)
Creates a
For-comprehension of 5 Trys. |
static <T1,T2,T3,T4,T5> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5)
Creates a
For-comprehension of 5 Trys. |
static <T1,T2,T3,T4,T5> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5)
Creates a
For-comprehension of 5 Trys. |
static <T1,T2,T3,T4,T5> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5)
Creates a
For-comprehension of 5 Trys. |
static <T1,T2,T3,T4,T5,T6> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6)
Creates a
For-comprehension of 6 Trys. |
static <T1,T2,T3,T4,T5,T6> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6)
Creates a
For-comprehension of 6 Trys. |
static <T1,T2,T3,T4,T5,T6> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6)
Creates a
For-comprehension of 6 Trys. |
static <T1,T2,T3,T4,T5,T6> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6)
Creates a
For-comprehension of 6 Trys. |
static <T1,T2,T3,T4,T5,T6> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6)
Creates a
For-comprehension of 6 Trys. |
static <T1,T2,T3,T4,T5,T6> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6)
Creates a
For-comprehension of 6 Trys. |
static <T1,T2,T3,T4,T5,T6,T7> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7)
Creates a
For-comprehension of 7 Trys. |
static <T1,T2,T3,T4,T5,T6,T7> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7)
Creates a
For-comprehension of 7 Trys. |
static <T1,T2,T3,T4,T5,T6,T7> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7)
Creates a
For-comprehension of 7 Trys. |
static <T1,T2,T3,T4,T5,T6,T7> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7)
Creates a
For-comprehension of 7 Trys. |
static <T1,T2,T3,T4,T5,T6,T7> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7)
Creates a
For-comprehension of 7 Trys. |
static <T1,T2,T3,T4,T5,T6,T7> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7)
Creates a
For-comprehension of 7 Trys. |
static <T1,T2,T3,T4,T5,T6,T7> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7)
Creates a
For-comprehension of 7 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
static <T1,T2,T3,T4,T5,T6,T7,T8> |
API.For(Try<T1> ts1,
Try<T2> ts2,
Try<T3> ts3,
Try<T4> ts4,
Try<T5> ts5,
Try<T6> ts6,
Try<T7> ts7,
Try<T8> ts8)
Creates a
For-comprehension of 8 Trys. |
| Modifier and Type | Method and Description |
|---|---|
Option<Try<T>> |
Future.getValue()
Returns the value of the Future.
|
| Modifier and Type | Method and Description |
|---|---|
default Promise<T> |
Promise.complete(Try<? extends T> value)
Completes this
Promise with the given value. |
static <T> Promise<T> |
Promise.fromTry(Executor executor,
Try<? extends T> result)
|
static <T> Future<T> |
Future.fromTry(Executor executor,
Try<? extends T> result)
|
static <T> Promise<T> |
Promise.fromTry(Try<? extends T> result)
|
static <T> Future<T> |
Future.fromTry(Try<? extends T> result)
|
boolean |
Promise.tryComplete(Try<? extends T> value)
Attempts to completes this
Promise with the given value. |
boolean |
Task.Complete.with(Try<? extends T> value)
A function that takes a
Try (success or failure) and returns the state of completion. |
| Modifier and Type | Method and Description |
|---|---|
default Future<T> |
Future.andThen(Consumer<? super Try<T>> action)
Support for chaining of callbacks that are guaranteed to be executed in a specific order.
|
Future<T> |
Future.onComplete(Consumer<? super Try<T>> action)
Performs the action once the Future is complete.
|
default <U> Future<U> |
Future.transformValue(Function<? super Try<T>,? extends Try<? extends U>> f)
Transforms the value of this
Future, whether it is a success or a failure. |
default <U> Future<U> |
Future.transformValue(Function<? super Try<T>,? extends Try<? extends U>> f)
Transforms the value of this
Future, whether it is a success or a failure. |
| Modifier and Type | Class and Description |
|---|---|
static class |
Try.Failure<T>
A failed Try.
|
static class |
Try.Success<T>
A succeeded Try.
|
| Modifier and Type | Method and Description |
|---|---|
default Try<T> |
Try.andFinally(Runnable runnable)
Provides try's finally behavior no matter what the result of the operation is.
|
default Try<T> |
Try.andFinallyTry(CheckedRunnable runnable)
Provides try's finally behavior no matter what the result of the operation is.
|
default Try<T> |
Try.andThen(Consumer<? super T> consumer)
Shortcut for
andThenTry(consumer::accept), see andThenTry(CheckedConsumer). |
default Try<T> |
Try.andThen(Runnable runnable)
Shortcut for
andThenTry(runnable::run), see andThenTry(CheckedRunnable). |
default Try<T> |
Try.andThenTry(CheckedConsumer<? super T> consumer)
Passes the result to the given
consumer if this is a Success. |
default Try<T> |
Try.andThenTry(CheckedRunnable runnable)
Runs the given runnable if this is a
Success, otherwise returns this Failure. |
default <R> Try<R> |
Try.collect(PartialFunction<? super T,? extends R> partialFunction)
Collects value that is in the domain of the given
partialFunction by mapping the value to type R. |
default Try<Throwable> |
Try.failed()
Returns
Success(throwable) if this is a Failure(throwable), otherwise
a Failure(new NoSuchElementException("Success.failed()")) if this is a Success. |
static <T> Try<T> |
Try.failure(Throwable exception)
Creates a
Try.Failure that contains the given exception. |
default Try<T> |
Try.filter(Predicate<? super T> predicate)
Shortcut for
filterTry(predicate::test), see filterTry(CheckedPredicate)}. |
default Try<T> |
Try.filter(Predicate<? super T> predicate,
Function<? super T,? extends Throwable> errorProvider)
Shortcut for
filterTry(predicate::test, errorProvider::apply), see
filterTry(CheckedPredicate, CheckedFunction1)}. |
default Try<T> |
Try.filter(Predicate<? super T> predicate,
Supplier<? extends Throwable> throwableSupplier)
Shortcut for
filterTry(predicate::test, throwableSupplier), see
filterTry(CheckedPredicate, Supplier)}. |
default Try<T> |
Try.filterTry(CheckedPredicate<? super T> predicate)
Returns
this if this is a Failure or this is a Success and the value satisfies the predicate. |
default Try<T> |
Try.filterTry(CheckedPredicate<? super T> predicate,
CheckedFunction1<? super T,? extends Throwable> errorProvider)
Returns
this if this is a Failure or this is a Success and the value satisfies the predicate. |
default Try<T> |
Try.filterTry(CheckedPredicate<? super T> predicate,
Supplier<? extends Throwable> throwableSupplier)
Returns
this if this is a Failure or this is a Success and the value satisfies the predicate. |
default <U> Try<U> |
Try.flatMap(Function<? super T,? extends Try<? extends U>> mapper)
Shortcut for
flatMapTry(mapper::apply), see flatMapTry(CheckedFunction1). |
default <U> Try<U> |
Try.flatMapTry(CheckedFunction1<? super T,? extends Try<? extends U>> mapper)
FlatMaps the value of a Success or returns a Failure.
|
default <U> Try<U> |
Try.map(Function<? super T,? extends U> mapper)
Shortcut for
mapTry(mapper::apply), see mapTry(CheckedFunction1). |
default Try<T> |
Try.mapFailure(API.Match.Case<? extends Throwable,? extends Throwable>... cases)
Maps the cause to a new exception if this is a
Failure or returns this instance if this is a Success. |
default <U> Try<U> |
Try.mapTry(CheckedFunction1<? super T,? extends U> mapper)
Runs the given checked function if this is a
Try.Success,
passing the result of the current expression to it. |
static <T> Try<T> |
Try.narrow(Try<? extends T> t)
Narrows a widened
Try<? extends T> to Try<T>
by performing a type-safe cast. |
static <T> Try<T> |
Try.of(CheckedFunction0<? extends T> supplier)
Creates a Try of a CheckedFunction0.
|
<R> Try<R> |
Try.WithResources1.of(CheckedFunction1<? super T1,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
<R> Try<R> |
Try.WithResources2.of(CheckedFunction2<? super T1,? super T2,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
<R> Try<R> |
Try.WithResources3.of(CheckedFunction3<? super T1,? super T2,? super T3,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
<R> Try<R> |
Try.WithResources4.of(CheckedFunction4<? super T1,? super T2,? super T3,? super T4,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
<R> Try<R> |
Try.WithResources5.of(CheckedFunction5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
<R> Try<R> |
Try.WithResources6.of(CheckedFunction6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
<R> Try<R> |
Try.WithResources7.of(CheckedFunction7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
<R> Try<R> |
Try.WithResources8.of(CheckedFunction8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> f)
Wraps the result of a computation that may fail in a
Try. |
static <T> Try<T> |
Try.ofCallable(Callable<? extends T> callable)
Creates a Try of a Callable.
|
static <T> Try<T> |
Try.ofSupplier(Supplier<? extends T> supplier)
Creates a Try of a Supplier.
|
default <X extends Throwable> |
Try.onFailure(Class<X> exceptionType,
Consumer<? super X> action)
Consumes the cause if this is a
Try.Failure and the cause is instance of X. |
default Try<T> |
Try.onFailure(Consumer<? super Throwable> action)
Consumes the cause if this is a
Try.Failure. |
default Try<T> |
Try.onSuccess(Consumer<? super T> action)
Consumes the value if this is a
Try.Success. |
default Try<T> |
Try.orElse(Supplier<? extends Try<? extends T>> supplier) |
default Try<T> |
Try.orElse(Try<? extends T> other) |
default Try<T> |
Try.peek(Consumer<? super T> action)
Applies the action to the value of a Success or does nothing in the case of a Failure.
|
default <X extends Throwable> |
Try.recover(Class<X> exceptionType,
Function<? super X,? extends T> f)
Returns
this, if this is a Success or this is a Failure and the cause is not assignable
from cause.getClass(). |
default <X extends Throwable> |
Try.recover(Class<X> exceptionType,
T value)
Returns
this, if this is a Try.Success or this is a Failure and the cause is not assignable
from cause.getClass(). |
default Try<T> |
Try.recover(Function<? super Throwable,? extends T> f)
Returns
this, if this is a Success, otherwise tries to recover the exception of the failure with f,
i.e. |
default <X extends Throwable> |
Try.recoverWith(Class<X> exceptionType,
Function<? super X,Try<? extends T>> f)
Returns
this, if this is a Success or this is a Failure and the cause is not assignable
from cause.getClass(). |
default <X extends Throwable> |
Try.recoverWith(Class<X> exceptionType,
Try<? extends T> recovered)
Recovers this
Try with the given recovered, if this is a Try.Failure
and the given exceptionType is assignable to the underlying cause type. |
default Try<T> |
Try.recoverWith(Function<? super Throwable,? extends Try<? extends T>> f)
Returns
this, if this is a Success, otherwise tries to recover the exception of the failure with f,
i.e. |
static Try<Void> |
Try.run(CheckedRunnable runnable)
Creates a Try of a CheckedRunnable.
|
static Try<Void> |
Try.runRunnable(Runnable runnable)
Creates a Try of a Runnable.
|
static <T> Try<Seq<T>> |
Try.sequence(Iterable<? extends Try<? extends T>> values)
Reduces many
Trys into a single Try by transforming an
Iterable<Try<? extends T>> into a Try<Seq<T>>. |
static <T> Try<T> |
Try.success(T value)
Creates a
Try.Success that contains the given value. |
static <T,U> Try<Seq<U>> |
Try.traverse(Iterable<? extends T> values,
Function<? super T,? extends Try<? extends U>> mapper)
Maps the values of an iterable to a sequence of mapped values into a single
Try by
transforming an Iterable<? extends T> into a Try<Seq<U>>. |
| Modifier and Type | Method and Description |
|---|---|
static <T> Validation<Throwable,T> |
Validation.fromTry(Try<? extends T> t)
Creates a
Validation of an Try. |
static <T> Try<T> |
Try.narrow(Try<? extends T> t)
Narrows a widened
Try<? extends T> to Try<T>
by performing a type-safe cast. |
default Try<T> |
Try.orElse(Try<? extends T> other) |
default <X extends Throwable> |
Try.recoverWith(Class<X> exceptionType,
Try<? extends T> recovered)
Recovers this
Try with the given recovered, if this is a Try.Failure
and the given exceptionType is assignable to the underlying cause type. |
| Modifier and Type | Method and Description |
|---|---|
default <U> Try<U> |
Try.flatMap(Function<? super T,? extends Try<? extends U>> mapper)
Shortcut for
flatMapTry(mapper::apply), see flatMapTry(CheckedFunction1). |
default <U> Try<U> |
Try.flatMapTry(CheckedFunction1<? super T,? extends Try<? extends U>> mapper)
FlatMaps the value of a Success or returns a Failure.
|
default Try<T> |
Try.orElse(Supplier<? extends Try<? extends T>> supplier) |
default <X extends Throwable> |
Try.recoverWith(Class<X> exceptionType,
Function<? super X,Try<? extends T>> f)
Returns
this, if this is a Success or this is a Failure and the cause is not assignable
from cause.getClass(). |
default Try<T> |
Try.recoverWith(Function<? super Throwable,? extends Try<? extends T>> f)
Returns
this, if this is a Success, otherwise tries to recover the exception of the failure with f,
i.e. |
static <T> Try<Seq<T>> |
Try.sequence(Iterable<? extends Try<? extends T>> values)
Reduces many
Trys into a single Try by transforming an
Iterable<Try<? extends T>> into a Try<Seq<T>>. |
default <U> U |
Try.transform(Function<? super Try<T>,? extends U> f)
Transforms this
Try. |
static <T,U> Try<Seq<U>> |
Try.traverse(Iterable<? extends T> values,
Function<? super T,? extends Try<? extends U>> mapper)
Maps the values of an iterable to a sequence of mapped values into a single
Try by
transforming an Iterable<? extends T> into a Try<Seq<U>>. |
Copyright © 2021. All Rights Reserved.