Package | Description |
---|---|
javaslang | |
javaslang.concurrent |
This package contains basic building blocks creating fast, asynchronous, non-blocking parallel code.
|
javaslang.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 . |
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(ExecutorService executorService,
Try<? extends T> result)
|
static <T> Future<T> |
Future.fromTry(ExecutorService executorService,
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 . |
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.
|
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.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(Try.CheckedConsumer<? super T> consumer)
Passes the result to the given
consumer if this is a Success . |
default Try<T> |
Try.andThenTry(Try.CheckedRunnable runnable)
Runs the given runnable if this is a
Success , otherwise returns this Failure . |
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.filterTry(Try.CheckedPredicate<? super T> predicate)
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(CheckedFunction) . |
default <U> Try<U> |
Try.flatMapTry(Try.CheckedFunction<? 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(CheckedFunction) . |
default <U> Try<U> |
Try.mapTry(Try.CheckedFunction<? super T,? extends U> mapper)
Runs the given checked function if this is a
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(Try.CheckedSupplier<? extends T> supplier)
Creates a Try of a CheckedSupplier.
|
default Try<T> |
Try.onFailure(Consumer<? super Throwable> action)
Consumes the throwable if this is a Failure.
|
default Try<T> |
Try.onSuccess(Consumer<? super T> action)
Consumes the value if this is a 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 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 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(Try.CheckedRunnable runnable)
Creates a Try of a CheckedRunnable.
|
static <T> Try<Seq<T>> |
Try.sequence(Iterable<? extends Try<? extends T>> values)
Reduces many
Try s 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 . |
Modifier and Type | Method and Description |
---|---|
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) |
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(CheckedFunction) . |
default <U> Try<U> |
Try.flatMapTry(Try.CheckedFunction<? 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 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
Try s 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 . |
Copyright © 2016. All Rights Reserved.