Uses of Interface
io.vavr.control.Try
-
Packages that use Try Package Description io.vavr BesideAPI
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 -
-
Uses of Try in io.vavr
Fields in io.vavr declared as Try Modifier and Type Field Description private Try<T1>
API.For1Try. ts1
private Try<T1>
API.For2Try. ts1
private Try<T1>
API.For3Try. ts1
private Try<T1>
API.For4Try. ts1
private Try<T1>
API.For5Try. ts1
private Try<T1>
API.For6Try. ts1
private Try<T1>
API.For7Try. ts1
private Try<T1>
API.For8Try. ts1
private Try<T2>
API.For2Try. ts2
private Try<T2>
API.For3Try. ts2
private Try<T2>
API.For4Try. ts2
private Try<T2>
API.For5Try. ts2
private Try<T2>
API.For6Try. ts2
private Try<T2>
API.For7Try. ts2
private Try<T2>
API.For8Try. ts2
private Try<T3>
API.For3Try. ts3
private Try<T3>
API.For4Try. ts3
private Try<T3>
API.For5Try. ts3
private Try<T3>
API.For6Try. ts3
private Try<T3>
API.For7Try. ts3
private Try<T3>
API.For8Try. ts3
private Try<T4>
API.For4Try. ts4
private Try<T4>
API.For5Try. ts4
private Try<T4>
API.For6Try. ts4
private Try<T4>
API.For7Try. ts4
private Try<T4>
API.For8Try. ts4
private Try<T5>
API.For5Try. ts5
private Try<T5>
API.For6Try. ts5
private Try<T5>
API.For7Try. ts5
private Try<T5>
API.For8Try. ts5
private Try<T6>
API.For6Try. ts6
private Try<T6>
API.For7Try. ts6
private Try<T6>
API.For8Try. ts6
private Try<T7>
API.For7Try. ts7
private Try<T7>
API.For8Try. ts7
private Try<T8>
API.For8Try. ts8
Methods in io.vavr with type parameters of type Try Modifier and Type Method Description static <T,_1 extends Option<Try<T>>>
API.Match.Pattern1<Future<T>,_1>Patterns. $Future(API.Match.Pattern<_1,?> p1)
Methods in io.vavr that return Try Modifier and Type Method Description default Try<T>
Value. toTry()
Converts this to aTry
.default Try<T>
Value. toTry(java.util.function.Supplier<? extends java.lang.Throwable> ifEmpty)
Converts this to aTry
.static <T> Try<T>
API. Try(CheckedFunction0<? extends T> supplier)
Alias forof(CheckedFunction0)
Try<T1>
API.For1Try. yield()
A shortcut foryield(Function.identity())
.<R> Try<R>
API.For1Try. yield(java.util.function.Function<? super T1,? extends R> f)
Yields a result for elements of the cross product of the underlying Try.<R> Try<R>
API.For2Try. yield(java.util.function.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.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.Methods in io.vavr that return types with arguments of type Try Modifier and Type Method Description (package private) static <T> Tuple1<Option<Try<T>>>
$. Future(Future<T> future)
static <R> Function0<Try<R>>
CheckedFunction0. liftTry(CheckedFunction0<? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,R>
Function1<T1,Try<R>>CheckedFunction1. liftTry(CheckedFunction1<? super T1,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,R>
Function2<T1,T2,Try<R>>CheckedFunction2. liftTry(CheckedFunction2<? super T1,? super T2,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,R>
Function3<T1,T2,T3,Try<R>>CheckedFunction3. liftTry(CheckedFunction3<? super T1,? super T2,? super T3,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,R>
Function4<T1,T2,T3,T4,Try<R>>CheckedFunction4. liftTry(CheckedFunction4<? super T1,? super T2,? super T3,? super T4,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,R>
Function5<T1,T2,T3,T4,T5,Try<R>>CheckedFunction5. liftTry(CheckedFunction5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,T6,R>
Function6<T1,T2,T3,T4,T5,T6,Try<R>>CheckedFunction6. liftTry(CheckedFunction6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,T6,T7,R>
Function7<T1,T2,T3,T4,T5,T6,T7,Try<R>>CheckedFunction7. liftTry(CheckedFunction7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,T6,T7,T8,R>
Function8<T1,T2,T3,T4,T5,T6,T7,T8,Try<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 givenpartialFunction
into a total function that returns anTry
result.static <R> Function0<Try<R>>
Function0. liftTry(java.util.function.Supplier<? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,R>
Function1<T1,Try<R>>Function1. liftTry(java.util.function.Function<? super T1,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,R>
Function2<T1,T2,Try<R>>Function2. liftTry(java.util.function.BiFunction<? super T1,? super T2,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,R>
Function3<T1,T2,T3,Try<R>>Function3. liftTry(Function3<? super T1,? super T2,? super T3,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,R>
Function4<T1,T2,T3,T4,Try<R>>Function4. liftTry(Function4<? super T1,? super T2,? super T3,? super T4,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,R>
Function5<T1,T2,T3,T4,T5,Try<R>>Function5. liftTry(Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,T6,R>
Function6<T1,T2,T3,T4,T5,T6,Try<R>>Function6. liftTry(Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,T6,T7,R>
Function7<T1,T2,T3,T4,T5,T6,T7,Try<R>>Function7. liftTry(Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> partialFunction)
Lifts the givenpartialFunction
into a total function that returns anTry
result.static <T1,T2,T3,T4,T5,T6,T7,T8,R>
Function8<T1,T2,T3,T4,T5,T6,T7,T8,Try<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 givenpartialFunction
into a total function that returns anTry
result.Methods in io.vavr with parameters of type Try Modifier and Type Method Description static <T1> API.For1Try<T1>
API. For(Try<T1> ts1)
Creates aFor
-comprehension of one Try.static <T1,T2>
API.For2Try<T1,T2>API. For(Try<T1> ts1, Try<T2> ts2)
Creates aFor
-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 aFor
-comprehension of three Trys.static <T1,T2,T3,T4>
API.For4Try<T1,T2,T3,T4>API. For(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4)
Creates aFor
-comprehension of 4 Trys.static <T1,T2,T3,T4,T5>
API.For5Try<T1,T2,T3,T4,T5>API. For(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5)
Creates aFor
-comprehension of 5 Trys.static <T1,T2,T3,T4,T5,T6>
API.For6Try<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 aFor
-comprehension of 6 Trys.static <T1,T2,T3,T4,T5,T6,T7>
API.For7Try<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 aFor
-comprehension of 7 Trys.static <T1,T2,T3,T4,T5,T6,T7,T8>
API.For8Try<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 aFor
-comprehension of 8 Trys.Constructors in io.vavr with parameters of type Try Constructor Description For1Try(Try<T1> ts1)
For2Try(Try<T1> ts1, Try<T2> ts2)
For3Try(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3)
For4Try(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4)
For5Try(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5)
For6Try(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6)
For7Try(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6, Try<T7> ts7)
For8Try(Try<T1> ts1, Try<T2> ts2, Try<T3> ts3, Try<T4> ts4, Try<T5> ts5, Try<T6> ts6, Try<T7> ts7, Try<T8> ts8)
-
Uses of Try in io.vavr.concurrent
Fields in io.vavr.concurrent with type parameters of type Try Modifier and Type Field Description private Queue<java.util.function.Consumer<Try<T>>>
FutureImpl. actions
The queue of actions is filled when calling onComplete() before the Future is completed or cancelled.private Option<Try<T>>
FutureImpl. value
Once the Future is completed, the value is defined.Methods in io.vavr.concurrent that return types with arguments of type Try Modifier and Type Method Description Option<Try<T>>
Future. getValue()
Returns the value of the Future.Option<Try<T>>
FutureImpl. getValue()
Methods in io.vavr.concurrent with parameters of type Try Modifier and Type Method Description default Promise<T>
Promise. complete(Try<? extends T> value)
Completes thisPromise
with the givenvalue
.static <T> Future<T>
Future. fromTry(Try<? extends T> result)
static <T> Future<T>
Future. fromTry(java.util.concurrent.Executor executor, Try<? extends T> result)
static <T> Promise<T>
Promise. fromTry(Try<? extends T> result)
static <T> Promise<T>
Promise. fromTry(java.util.concurrent.Executor executor, Try<? extends T> result)
(package private) static <T> FutureImpl<T>
FutureImpl. of(java.util.concurrent.Executor executor, Try<? extends T> value)
Creates aFutureImpl
that is immediately completed with the given value.(package private) boolean
FutureImpl. tryComplete(Try<? extends T> value)
INTERNAL METHOD, SHOULD BE USED BY THE CONSTRUCTOR, ONLY.boolean
Promise. tryComplete(Try<? extends T> value)
Attempts to completes thisPromise
with the givenvalue
.boolean
PromiseImpl. tryComplete(Try<? extends T> value)
boolean
Task.Complete. with(Try<? extends T> value)
A function that takes aTry
(success or failure) and returns the state of completion.Method parameters in io.vavr.concurrent with type arguments of type Try Modifier and Type Method Description default Future<T>
Future. andThen(java.util.function.Consumer<? super Try<T>> action)
Support for chaining of callbacks that are guaranteed to be executed in a specific order.Future<T>
Future. onComplete(java.util.function.Consumer<? super Try<T>> action)
Performs the action once the Future is complete.Future<T>
FutureImpl. onComplete(java.util.function.Consumer<? super Try<T>> action)
private void
FutureImpl. perform(java.util.function.Consumer<? super Try<T>> action)
default <U> Future<U>
Future. transformValue(java.util.function.Function<? super Try<T>,? extends Try<? extends U>> f)
Transforms the value of thisFuture
, whether it is a success or a failure.default <U> Future<U>
Future. transformValue(java.util.function.Function<? super Try<T>,? extends Try<? extends U>> f)
Transforms the value of thisFuture
, whether it is a success or a failure.Constructor parameters in io.vavr.concurrent with type arguments of type Try Constructor Description FutureImpl(java.util.concurrent.Executor executor, Option<Try<T>> value, Queue<java.util.function.Consumer<Try<T>>> actions, Queue<java.lang.Thread> waiters, FutureImpl.Computation<T> computation)
FutureImpl(java.util.concurrent.Executor executor, Option<Try<T>> value, Queue<java.util.function.Consumer<Try<T>>> actions, Queue<java.lang.Thread> waiters, FutureImpl.Computation<T> computation)
-
Uses of Try in io.vavr.control
Classes in io.vavr.control that implement Try Modifier and Type Class Description static class
Try.Failure<T>
A failed Try.static class
Try.Success<T>
A succeeded Try.Methods in io.vavr.control that return Try Modifier and Type Method Description default Try<T>
Try. andFinally(java.lang.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(java.lang.Runnable runnable)
Shortcut forandThenTry(runnable::run)
, seeandThenTry(CheckedRunnable)
.default Try<T>
Try. andThen(java.util.function.Consumer<? super T> consumer)
Shortcut forandThenTry(consumer::accept)
, seeandThenTry(CheckedConsumer)
.default Try<T>
Try. andThenTry(CheckedConsumer<? super T> consumer)
Passes the result to the givenconsumer
if this is aSuccess
.default Try<T>
Try. andThenTry(CheckedRunnable runnable)
Runs the given runnable if this is aSuccess
, otherwise returns thisFailure
.default <R> Try<R>
Try. collect(PartialFunction<? super T,? extends R> partialFunction)
Collects value that is in the domain of the givenpartialFunction
by mapping the value to typeR
.default Try<java.lang.Throwable>
Try. failed()
ReturnsSuccess(throwable)
if this is aFailure(throwable)
, otherwise aFailure(new NoSuchElementException("Success.failed()"))
if this is a Success.static <T> Try<T>
Try. failure(java.lang.Throwable exception)
Creates aTry.Failure
that contains the givenexception
.default Try<T>
Try. filter(java.util.function.Predicate<? super T> predicate)
Shortcut forfilterTry(predicate::test)
, seefilterTry(CheckedPredicate)
}.default Try<T>
Try. filter(java.util.function.Predicate<? super T> predicate, java.util.function.Function<? super T,? extends java.lang.Throwable> errorProvider)
Shortcut forfilterTry(predicate::test, errorProvider::apply)
, seefilterTry(CheckedPredicate, CheckedFunction1)
}.default Try<T>
Try. filter(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<? extends java.lang.Throwable> throwableSupplier)
Shortcut forfilterTry(predicate::test, throwableSupplier)
, seefilterTry(CheckedPredicate, Supplier)
}.default Try<T>
Try. filterTry(CheckedPredicate<? super T> predicate)
Returnsthis
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 java.lang.Throwable> errorProvider)
Returnsthis
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, java.util.function.Supplier<? extends java.lang.Throwable> throwableSupplier)
Returnsthis
if this is a Failure or this is a Success and the value satisfies the predicate.default <U> Try<U>
Try. flatMap(java.util.function.Function<? super T,? extends Try<? extends U>> mapper)
Shortcut forflatMapTry(mapper::apply)
, seeflatMapTry(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(java.util.function.Function<? super T,? extends U> mapper)
Shortcut formapTry(mapper::apply)
, seemapTry(CheckedFunction1)
.default Try<T>
Try. mapFailure(API.Match.Case<? extends java.lang.Throwable,? extends java.lang.Throwable>... cases)
Maps the cause to a new exception if this is aFailure
or returns this instance if this is aSuccess
.default <U> Try<U>
Try. mapTry(CheckedFunction1<? super T,? extends U> mapper)
Runs the given checked function if this is aTry.Success
, passing the result of the current expression to it.static <T> Try<T>
Try. narrow(Try<? extends T> t)
Narrows a widenedTry<? extends T>
toTry<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 aTry
.<R> Try<R>
Try.WithResources2. of(CheckedFunction2<? super T1,? super T2,? extends R> f)
Wraps the result of a computation that may fail in aTry
.<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 aTry
.<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 aTry
.<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 aTry
.<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 aTry
.<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 aTry
.<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 aTry
.static <T> Try<T>
Try. ofCallable(java.util.concurrent.Callable<? extends T> callable)
Creates a Try of a Callable.static <T> Try<T>
Try. ofSupplier(java.util.function.Supplier<? extends T> supplier)
Creates a Try of a Supplier.default <X extends java.lang.Throwable>
Try<T>Try. onFailure(java.lang.Class<X> exceptionType, java.util.function.Consumer<? super X> action)
Consumes the cause if this is aTry.Failure
and the cause is instance ofX
.default Try<T>
Try. onFailure(java.util.function.Consumer<? super java.lang.Throwable> action)
Consumes the cause if this is aTry.Failure
.default Try<T>
Try. onSuccess(java.util.function.Consumer<? super T> action)
Consumes the value if this is aTry.Success
.default Try<T>
Try. orElse(Try<? extends T> other)
default Try<T>
Try. orElse(java.util.function.Supplier<? extends Try<? extends T>> supplier)
default Try<T>
Try. peek(java.util.function.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 java.lang.Throwable>
Try<T>Try. recover(java.lang.Class<X> exceptionType, java.util.function.Function<? super X,? extends T> f)
Returnsthis
, if this is aSuccess
or this is aFailure
and the cause is not assignable fromcause.getClass()
.default <X extends java.lang.Throwable>
Try<T>Try. recover(java.lang.Class<X> exceptionType, T value)
Returnsthis
, if this is aTry.Success
or this is aFailure
and the cause is not assignable fromcause.getClass()
.default Try<T>
Try. recover(java.util.function.Function<? super java.lang.Throwable,? extends T> f)
Returnsthis
, if this is aSuccess
, otherwise tries to recover the exception of the failure withf
, i.e.default <X extends java.lang.Throwable>
Try<T>Try. recoverWith(java.lang.Class<X> exceptionType, Try<? extends T> recovered)
Recovers thisTry
with the givenrecovered
, if this is aTry.Failure
and the givenexceptionType
is assignable to the underlying cause type.default <X extends java.lang.Throwable>
Try<T>Try. recoverWith(java.lang.Class<X> exceptionType, java.util.function.Function<? super X,Try<? extends T>> f)
Returnsthis
, if this is aSuccess
or this is aFailure
and the cause is not assignable fromcause.getClass()
.default Try<T>
Try. recoverWith(java.util.function.Function<? super java.lang.Throwable,? extends Try<? extends T>> f)
Returnsthis
, if this is a Success, otherwise tries to recover the exception of the failure withf
, i.e.static Try<java.lang.Void>
Try. run(CheckedRunnable runnable)
Creates a Try of a CheckedRunnable.static Try<java.lang.Void>
Try. runRunnable(java.lang.Runnable runnable)
Creates a Try of a Runnable.static <T> Try<Seq<T>>
Try. sequence(java.lang.Iterable<? extends Try<? extends T>> values)
Reduces manyTry
s into a singleTry
by transforming anIterable<Try<? extends T>>
into aTry<Seq<T>>
.static <T> Try<T>
Try. success(T value)
Creates aTry.Success
that contains the givenvalue
.static <T,U>
Try<Seq<U>>Try. traverse(java.lang.Iterable<? extends T> values, java.util.function.Function<? super T,? extends Try<? extends U>> mapper)
Maps the values of an iterable to a sequence of mapped values into a singleTry
by transforming anIterable<? extends T>
into aTry<Seq<U>>
.Methods in io.vavr.control with parameters of type Try Modifier and Type Method Description static <T> Validation<java.lang.Throwable,T>
Validation. fromTry(Try<? extends T> t)
Creates aValidation
of anTry
.static <T> Try<T>
Try. narrow(Try<? extends T> t)
Narrows a widenedTry<? extends T>
toTry<T>
by performing a type-safe cast.default Try<T>
Try. orElse(Try<? extends T> other)
default <X extends java.lang.Throwable>
Try<T>Try. recoverWith(java.lang.Class<X> exceptionType, Try<? extends T> recovered)
Recovers thisTry
with the givenrecovered
, if this is aTry.Failure
and the givenexceptionType
is assignable to the underlying cause type.Method parameters in io.vavr.control with type arguments of type Try Modifier and Type Method Description default <U> Try<U>
Try. flatMap(java.util.function.Function<? super T,? extends Try<? extends U>> mapper)
Shortcut forflatMapTry(mapper::apply)
, seeflatMapTry(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(java.util.function.Supplier<? extends Try<? extends T>> supplier)
default <X extends java.lang.Throwable>
Try<T>Try. recoverWith(java.lang.Class<X> exceptionType, java.util.function.Function<? super X,Try<? extends T>> f)
Returnsthis
, if this is aSuccess
or this is aFailure
and the cause is not assignable fromcause.getClass()
.default Try<T>
Try. recoverWith(java.util.function.Function<? super java.lang.Throwable,? extends Try<? extends T>> f)
Returnsthis
, if this is a Success, otherwise tries to recover the exception of the failure withf
, i.e.static <T> Try<Seq<T>>
Try. sequence(java.lang.Iterable<? extends Try<? extends T>> values)
Reduces manyTry
s into a singleTry
by transforming anIterable<Try<? extends T>>
into aTry<Seq<T>>
.default <U> U
Try. transform(java.util.function.Function<? super Try<T>,? extends U> f)
Transforms thisTry
.static <T,U>
Try<Seq<U>>Try. traverse(java.lang.Iterable<? extends T> values, java.util.function.Function<? super T,? extends Try<? extends U>> mapper)
Maps the values of an iterable to a sequence of mapped values into a singleTry
by transforming anIterable<? extends T>
into aTry<Seq<U>>
.
-