Uses of Interface
io.vavr.control.Try
Packages that use Try
Package
Description
Beside
API
the io.vavr package contains core types like (Checked)Functions and Tuples.This package contains basic building blocks for creating fast, asynchronous, non-blocking parallel code.
-
Uses of Try in io.vavr
Modifier and TypeFieldDescriptionAPI.For1Try.ts1
API.For2Try.ts1
API.For3Try.ts1
API.For4Try.ts1
API.For5Try.ts1
API.For6Try.ts1
API.For7Try.ts1
API.For8Try.ts1
API.For2Try.ts2
API.For3Try.ts2
API.For4Try.ts2
API.For5Try.ts2
API.For6Try.ts2
API.For7Try.ts2
API.For8Try.ts2
API.For3Try.ts3
API.For4Try.ts3
API.For5Try.ts3
API.For6Try.ts3
API.For7Try.ts3
API.For8Try.ts3
API.For4Try.ts4
API.For5Try.ts4
API.For6Try.ts4
API.For7Try.ts4
API.For8Try.ts4
API.For5Try.ts5
API.For6Try.ts5
API.For7Try.ts5
API.For8Try.ts5
API.For6Try.ts6
API.For7Try.ts6
API.For8Try.ts6
API.For7Try.ts7
API.For8Try.ts7
API.For8Try.ts8
Modifier and TypeMethodDescriptionstatic <T,
_1 extends Option<Try<T>>>
API.Match.Pattern1<Future<T>, _1> Patterns.$Future
(API.Match.Pattern<_1, ?> p1) Modifier and TypeMethodDescriptionValue.toTry()
Converts this to aTry
.Converts this to aTry
.static <T> Try
<T> API.Try
(CheckedFunction0<? extends T> supplier) Alias forof(CheckedFunction0)
API.For1Try.yield()
A shortcut foryield(Function.identity())
.<R> Try
<R> Yields a result for elements of the cross product of the underlying Try.<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> Yields a result for elements of the cross product of the underlying Trys.<R> Try
<R> Yields a result for elements of the cross product of the underlying Trys.<R> Try
<R> 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 TypeMethodDescriptionCheckedFunction0.liftTry
(CheckedFunction0<? extends R> partialFunction) Lifts the givenpartialFunction
into a total function that returns anTry
result.CheckedFunction1.liftTry
(CheckedFunction1<? super T1, ? extends R> partialFunction) Lifts the givenpartialFunction
into a total function that returns anTry
result.CheckedFunction2.liftTry
(CheckedFunction2<? super T1, ? super T2, ? extends R> partialFunction) Lifts the givenpartialFunction
into a total function that returns anTry
result.CheckedFunction3.liftTry
(CheckedFunction3<? super T1, ? super T2, ? super T3, ? extends R> partialFunction) Lifts the givenpartialFunction
into a total function that returns anTry
result.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.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.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.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.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.Lifts the givenpartialFunction
into a total function that returns anTry
result.Lifts the givenpartialFunction
into a total function that returns anTry
result.Function2.liftTry
(BiFunction<? super T1, ? super T2, ? extends R> partialFunction) Lifts the givenpartialFunction
into a total function that returns anTry
result.Lifts the givenpartialFunction
into a total function that returns anTry
result.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.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.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.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.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.Modifier and TypeMethodDescriptionstatic <T1> API.For1Try
<T1> Creates aFor
-comprehension of one Try.static <T1,
T2> API.For2Try <T1, T2> Creates aFor
-comprehension of two Trys.static <T1,
T2, T3>
API.For3Try<T1, T2, T3> Creates aFor
-comprehension of three Trys.static <T1,
T2, T3, T4>
API.For4Try<T1, T2, T3, T4> Creates aFor
-comprehension of 4 Trys.static <T1,
T2, T3, T4, T5>
API.For5Try<T1, T2, T3, T4, T5> Creates aFor
-comprehension of 5 Trys.static <T1,
T2, T3, T4, T5, T6>
API.For6Try<T1, T2, T3, T4, T5, T6> Creates aFor
-comprehension of 6 Trys.static <T1,
T2, T3, T4, T5, T6, T7>
API.For7Try<T1, T2, T3, T4, T5, T6, T7> 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. -
Uses of Try in io.vavr.concurrent
Fields in io.vavr.concurrent with type parameters of type TryModifier and TypeFieldDescriptionFutureImpl.actions
The queue of actions is filled when calling onComplete() before the Future is completed or cancelled.FutureImpl.value
Once the Future is completed, the value is defined.Methods in io.vavr.concurrent that return types with arguments of type TryModifier and TypeMethodDescriptionFuture.getValue()
Returns the value of the Future.FutureImpl.getValue()
Methods in io.vavr.concurrent with parameters of type TryModifier and TypeMethodDescriptionCompletes thisPromise
with the givenvalue
.static <T> Future
<T> static <T> Future
<T> static <T> Promise
<T> static <T> Promise
<T> (package private) static <T> FutureImpl
<T> 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
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 TryModifier and TypeMethodDescriptionSupport for chaining of callbacks that are guaranteed to be executed in a specific order.Future.onComplete
(Consumer<? super Try<T>> action) Performs the action once the Future is complete.FutureImpl.onComplete
(Consumer<? super Try<T>> action) private void
default <U> Future
<U> Future.transformValue
(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
(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 TryModifierConstructorDescriptionprivate
FutureImpl
(Executor executor, Option<Try<T>> value, Queue<Consumer<Try<T>>> actions, Queue<Thread> waiters, FutureImpl.Computation<T> computation) private
FutureImpl
(Executor executor, Option<Try<T>> value, Queue<Consumer<Try<T>>> actions, Queue<Thread> waiters, FutureImpl.Computation<T> computation) -
Uses of Try in io.vavr.control
Classes in io.vavr.control that implement TryModifier and TypeClassDescriptionstatic final class
Try.Failure<T>
A failed Try.static final class
Try.Success<T>
A succeeded Try.Methods in io.vavr.control that return TryModifier and TypeMethodDescriptionTry.andFinally
(Runnable runnable) Provides try's finally behavior no matter what the result of the operation is.Try.andFinallyTry
(CheckedRunnable runnable) Provides try's finally behavior no matter what the result of the operation is.Shortcut forandThenTry(runnable::run)
, seeandThenTry(CheckedRunnable)
.Shortcut forandThenTry(consumer::accept)
, seeandThenTry(CheckedConsumer)
.Try.andThenTry
(CheckedConsumer<? super T> consumer) Passes the result to the givenconsumer
if this is aSuccess
.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
.Try.failed()
ReturnsSuccess(throwable)
if this is aFailure(throwable)
, otherwise aFailure(new NoSuchElementException("Success.failed()"))
if this is a Success.static <T> Try
<T> Creates aTry.Failure
that contains the givenexception
.Shortcut forfilterTry(predicate::test)
, seefilterTry(CheckedPredicate)
}.Shortcut forfilterTry(predicate::test, errorProvider::apply)
, seefilterTry(CheckedPredicate, CheckedFunction1)
}.Shortcut forfilterTry(predicate::test, throwableSupplier)
, seefilterTry(CheckedPredicate, Supplier)
}.Try.filterTry
(CheckedPredicate<? super T> predicate) Returnsthis
if this is a Failure or this is a Success and the value satisfies the predicate.Try.filterTry
(CheckedPredicate<? super T> predicate, CheckedFunction1<? super T, ? extends Throwable> errorProvider) Returnsthis
if this is a Failure or this is a Success and the value satisfies the predicate.Try.filterTry
(CheckedPredicate<? super T> predicate, Supplier<? extends Throwable> throwableSupplier) Returnsthis
if this is a Failure or this is a Success and the value satisfies the predicate.default <U> Try
<U> 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> Shortcut formapTry(mapper::apply)
, seemapTry(CheckedFunction1)
.Try.mapFailure
(API.Match.Case<? extends Throwable, ? extends 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> 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> 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
(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.Consumes the cause if this is aTry.Failure
and the cause is instance ofX
.Consumes the cause if this is aTry.Failure
.Consumes the value if this is aTry.Success
.Applies the action to the value of a Success or does nothing in the case of a Failure.Returnsthis
, if this is aSuccess
or this is aFailure
and the cause is not assignable fromcause.getClass()
.Returnsthis
, if this is aTry.Success
or this is aFailure
and the cause is not assignable fromcause.getClass()
.Returnsthis
, if this is aSuccess
, otherwise tries to recover the exception of the failure withf
, i.e.Try.recoverWith
(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.Try.recoverWith
(Class<X> exceptionType, Function<? super X, Try<? extends T>> f) Returnsthis
, if this is aSuccess
or this is aFailure
and the cause is not assignable fromcause.getClass()
.Try.recoverWith
(Function<? super Throwable, ? extends Try<? extends T>> f) Returnsthis
, if this is a Success, otherwise tries to recover the exception of the failure withf
, i.e.Try.run
(CheckedRunnable runnable) Creates a Try of a CheckedRunnable.Try.runRunnable
(Runnable runnable) Creates a Try of a Runnable.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
.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 TryModifier and TypeMethodDescriptionstatic <T> Validation
<Throwable, T> Creates aValidation
of anTry
.static <T> Try
<T> Narrows a widenedTry<? extends T>
toTry<T>
by performing a type-safe cast.Try.recoverWith
(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 TryModifier and TypeMethodDescriptiondefault <U> Try
<U> 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.Try.recoverWith
(Class<X> exceptionType, Function<? super X, Try<? extends T>> f) Returnsthis
, if this is aSuccess
or this is aFailure
and the cause is not assignable fromcause.getClass()
.Try.recoverWith
(Function<? super Throwable, ? extends Try<? extends T>> f) Returnsthis
, if this is a Success, otherwise tries to recover the exception of the failure withf
, i.e.Reduces manyTry
s into a singleTry
by transforming anIterable<Try<? extends T>>
into aTry<Seq<T>>
.default <U> U
Transforms thisTry
.Maps the values of an iterable to a sequence of mapped values into a singleTry
by transforming anIterable<? extends T>
into aTry<Seq<U>>
.