Package | Description |
---|---|
io.vavr | |
io.vavr.concurrent |
This package contains basic building blocks creating fast, asynchronous, non-blocking parallel code.
|
Modifier and Type | Method and Description |
---|---|
static <T> Future<T> |
API.Future(CheckedFunction0<? extends T> computation)
Alias for
of(CheckedFunction0) |
static <T> Future<T> |
API.Future(ExecutorService executorService,
CheckedFunction0<? extends T> computation)
Alias for
of(ExecutorService, CheckedFunction0) |
static <T> Future<T> |
API.Future(ExecutorService executorService,
T result)
Alias for
successful(ExecutorService, Object) |
static <T> Future<T> |
API.Future(T result)
Alias for
successful(Object) |
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 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.await()
Blocks the current Thread until this Future completed or returns immediately if this Future is already completed.
|
default <R> Future<R> |
Future.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 Future<Throwable> |
Future.failed()
A projection that inverses the result of this Future.
|
static <T> Future<T> |
Future.failed(ExecutorService executorService,
Throwable exception)
|
static <T> Future<T> |
Future.failed(Throwable exception)
|
default Future<T> |
Future.fallbackTo(Future<? extends T> that)
Returns a Future that returns the result of this Future, if it is a success.
|
default Future<T> |
Future.filter(Predicate<? super T> predicate)
Shortcut for
filterTry(predicate::test . |
default Future<T> |
Future.filterTry(CheckedPredicate<? super T> predicate)
Filters the result of this
Future by calling Try.filterTry(CheckedPredicate) . |
static <T> Future<Option<T>> |
Future.find(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures,
Predicate<? super T> predicate)
Returns a
Future that eventually succeeds with the first result of the given Future s which
matches the given predicate . |
static <T> Future<Option<T>> |
Future.find(Iterable<? extends Future<? extends T>> futures,
Predicate<? super T> predicate)
Returns a
Future that eventually succeeds with the first result of the given Future s which
matches the given predicate . |
static <T> Future<T> |
Future.firstCompletedOf(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures)
Returns a new
Future that will contain the result of the first of the given futures that is completed,
backed by the given ExecutorService . |
static <T> Future<T> |
Future.firstCompletedOf(Iterable<? extends Future<? extends T>> futures)
Returns a new
Future that will contain the result of the first of the given futures that is completed,
backed by the DEFAULT_EXECUTOR_SERVICE . |
default <U> Future<U> |
Future.flatMap(Function<? super T,? extends Future<? extends U>> mapper) |
default <U> Future<U> |
Future.flatMapTry(CheckedFunction1<? super T,? extends Future<? extends U>> mapper) |
static <T,U> Future<U> |
Future.fold(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures,
U zero,
BiFunction<? super U,? super T,? extends U> f)
Returns a Future which contains the result of the fold of the given future values.
|
static <T,U> Future<U> |
Future.fold(Iterable<? extends Future<? extends T>> futures,
U zero,
BiFunction<? super U,? super T,? extends U> f)
Returns a Future which contains the result of the fold of the given future values.
|
static <T> Future<T> |
Future.fromCompletableFuture(CompletableFuture<T> future)
|
static <T> Future<T> |
Future.fromCompletableFuture(ExecutorService executorService,
CompletableFuture<T> future)
|
static <T> Future<T> |
Future.fromJavaFuture(ExecutorService executorService,
Future<T> future)
Creates a
Future with the given java.util.concurrent.Future, backed by given ExecutorService |
static <T> Future<T> |
Future.fromJavaFuture(Future<T> future)
Creates a
Future with the given java.util.concurrent.Future, backed by the DEFAULT_EXECUTOR_SERVICE |
static <T> Future<T> |
Future.fromTry(ExecutorService executorService,
Try<? extends T> result)
|
static <T> Future<T> |
Future.fromTry(Try<? extends T> result)
|
Future<T> |
Promise.future()
Returns the underlying
Future of this Promise . |
default <U> Future<U> |
Future.map(Function<? super T,? extends U> mapper) |
default <U> Future<U> |
Future.mapTry(CheckedFunction1<? super T,? extends U> mapper) |
static <T> Future<T> |
Future.narrow(Future<? extends T> future)
Narrows a widened
Future<? extends T> to Future<T>
by performing a type-safe cast. |
static <T> Future<T> |
Future.of(CheckedFunction0<? extends T> computation)
Starts an asynchronous computation, backed by the
DEFAULT_EXECUTOR_SERVICE . |
static <T> Future<T> |
Future.of(ExecutorService executorService,
CheckedFunction0<? extends T> computation)
Starts an asynchronous computation, backed by the given
ExecutorService . |
static <T> Future<T> |
Future.ofCallable(Callable<? extends T> computation)
Starts an asynchronous computation, backed by the
DEFAULT_EXECUTOR_SERVICE . |
static <T> Future<T> |
Future.ofCallable(ExecutorService executorService,
Callable<? extends T> computation)
Starts an asynchronous computation, backed by the given
ExecutorService . |
static <T> Future<T> |
Future.ofSupplier(ExecutorService executorService,
Supplier<? extends T> computation)
Starts an asynchronous computation, backed by the given
ExecutorService . |
static <T> Future<T> |
Future.ofSupplier(Supplier<? extends T> computation)
Starts an asynchronous computation, backed by the
DEFAULT_EXECUTOR_SERVICE . |
Future<T> |
Future.onComplete(Consumer<? super Try<T>> action)
Performs the action once the Future is complete.
|
default Future<T> |
Future.onFailure(Consumer<? super Throwable> action)
Performs the action once the Future is complete and the result is a
Try.Failure . |
default Future<T> |
Future.onSuccess(Consumer<? super T> action)
Performs the action once the Future is complete and the result is a
Try.Success . |
default Future<T> |
Future.orElse(Future<? extends T> other) |
default Future<T> |
Future.orElse(Supplier<? extends Future<? extends T>> supplier) |
default Future<T> |
Future.peek(Consumer<? super T> action) |
default Future<T> |
Future.recover(Function<? super Throwable,? extends T> f)
Handles a failure of this Future by returning another result.
|
default Future<T> |
Future.recoverWith(Function<? super Throwable,? extends Future<? extends T>> f)
Handles a failure of this Future by returning the result of another Future.
|
static <T> Future<T> |
Future.reduce(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures,
BiFunction<? super T,? super T,? extends T> f)
Returns a Future which contains the reduce result of the given future values.
|
static <T> Future<T> |
Future.reduce(Iterable<? extends Future<? extends T>> futures,
BiFunction<? super T,? super T,? extends T> f)
Returns a Future which contains the reduce result of the given future values.
|
static Future<Void> |
Future.run(CheckedRunnable unit)
Runs an asynchronous computation, backed by the
DEFAULT_EXECUTOR_SERVICE . |
static Future<Void> |
Future.run(ExecutorService executorService,
CheckedRunnable unit)
Starts an asynchronous computation, backed by the given
ExecutorService . |
static Future<Void> |
Future.runRunnable(ExecutorService executorService,
Runnable computation)
Starts an asynchronous computation, backed by the given
ExecutorService . |
static Future<Void> |
Future.runRunnable(Runnable computation)
Starts an asynchronous computation, backed by the
DEFAULT_EXECUTOR_SERVICE . |
static <T> Future<Seq<T>> |
Future.sequence(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures)
Reduces many
Future s into a single Future by transforming an
Iterable<Future<? extends T>> into a Future<Seq<T>> . |
static <T> Future<Seq<T>> |
Future.sequence(Iterable<? extends Future<? extends T>> futures)
Reduces many
Future s into a single Future by transforming an
Iterable<Future<? extends T>> into a Future<Seq<T>> . |
static <T> Future<T> |
Future.successful(ExecutorService executorService,
T result)
Creates a succeeded
Future , backed by the given ExecutorService . |
static <T> Future<T> |
Future.successful(T result)
Creates a succeeded
Future , backed by the DEFAULT_EXECUTOR_SERVICE . |
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. |
static <T,U> Future<Seq<U>> |
Future.traverse(ExecutorService executorService,
Iterable<? extends T> values,
Function<? super T,? extends Future<? extends U>> mapper)
Maps the values of an iterable in parallel to a sequence of mapped values into a single
Future by
transforming an Iterable<? extends T> into a Future<Seq<U>> . |
static <T,U> Future<Seq<U>> |
Future.traverse(Iterable<? extends T> values,
Function<? super T,? extends Future<? extends U>> mapper)
Maps the values of an iterable in parallel to a sequence of mapped values into a single
Future by
transforming an Iterable<? extends T> into a Future<Seq<U>> . |
default <U> Future<Tuple2<T,U>> |
Future.zip(Future<? extends U> that)
Returns a tuple of this and that Future result.
|
default <U,R> Future<R> |
Future.zipWith(Future<? extends U> that,
BiFunction<? super T,? super U,? extends R> combinator)
Returns a this and that Future result combined using a given combinator function.
|
Modifier and Type | Method and Description |
---|---|
default Promise<T> |
Promise.completeWith(Future<? extends T> other)
Completes this
Promise with the given Future , once that Future is completed. |
default Future<T> |
Future.fallbackTo(Future<? extends T> that)
Returns a Future that returns the result of this Future, if it is a success.
|
static <T> Future<T> |
Future.narrow(Future<? extends T> future)
Narrows a widened
Future<? extends T> to Future<T>
by performing a type-safe cast. |
default Future<T> |
Future.orElse(Future<? extends T> other) |
default Promise<T> |
Promise.tryCompleteWith(Future<? extends T> other)
Attempts to complete this
Promise with the specified Future , once that Future is completed. |
default <U> Future<Tuple2<T,U>> |
Future.zip(Future<? extends U> that)
Returns a tuple of this and that Future result.
|
default <U,R> Future<R> |
Future.zipWith(Future<? extends U> that,
BiFunction<? super T,? super U,? extends R> combinator)
Returns a this and that Future result combined using a given combinator function.
|
Modifier and Type | Method and Description |
---|---|
static <T> Future<Option<T>> |
Future.find(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures,
Predicate<? super T> predicate)
Returns a
Future that eventually succeeds with the first result of the given Future s which
matches the given predicate . |
static <T> Future<Option<T>> |
Future.find(Iterable<? extends Future<? extends T>> futures,
Predicate<? super T> predicate)
Returns a
Future that eventually succeeds with the first result of the given Future s which
matches the given predicate . |
static <T> Future<T> |
Future.firstCompletedOf(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures)
Returns a new
Future that will contain the result of the first of the given futures that is completed,
backed by the given ExecutorService . |
static <T> Future<T> |
Future.firstCompletedOf(Iterable<? extends Future<? extends T>> futures)
Returns a new
Future that will contain the result of the first of the given futures that is completed,
backed by the DEFAULT_EXECUTOR_SERVICE . |
default <U> Future<U> |
Future.flatMap(Function<? super T,? extends Future<? extends U>> mapper) |
default <U> Future<U> |
Future.flatMapTry(CheckedFunction1<? super T,? extends Future<? extends U>> mapper) |
static <T,U> Future<U> |
Future.fold(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures,
U zero,
BiFunction<? super U,? super T,? extends U> f)
Returns a Future which contains the result of the fold of the given future values.
|
static <T,U> Future<U> |
Future.fold(Iterable<? extends Future<? extends T>> futures,
U zero,
BiFunction<? super U,? super T,? extends U> f)
Returns a Future which contains the result of the fold of the given future values.
|
default Future<T> |
Future.orElse(Supplier<? extends Future<? extends T>> supplier) |
default Future<T> |
Future.recoverWith(Function<? super Throwable,? extends Future<? extends T>> f)
Handles a failure of this Future by returning the result of another Future.
|
static <T> Future<T> |
Future.reduce(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures,
BiFunction<? super T,? super T,? extends T> f)
Returns a Future which contains the reduce result of the given future values.
|
static <T> Future<T> |
Future.reduce(Iterable<? extends Future<? extends T>> futures,
BiFunction<? super T,? super T,? extends T> f)
Returns a Future which contains the reduce result of the given future values.
|
static <T> Future<Seq<T>> |
Future.sequence(ExecutorService executorService,
Iterable<? extends Future<? extends T>> futures)
Reduces many
Future s into a single Future by transforming an
Iterable<Future<? extends T>> into a Future<Seq<T>> . |
static <T> Future<Seq<T>> |
Future.sequence(Iterable<? extends Future<? extends T>> futures)
Reduces many
Future s into a single Future by transforming an
Iterable<Future<? extends T>> into a Future<Seq<T>> . |
default <U> U |
Future.transform(Function<? super Future<T>,? extends U> f)
Transforms this
Future . |
static <T,U> Future<Seq<U>> |
Future.traverse(ExecutorService executorService,
Iterable<? extends T> values,
Function<? super T,? extends Future<? extends U>> mapper)
Maps the values of an iterable in parallel to a sequence of mapped values into a single
Future by
transforming an Iterable<? extends T> into a Future<Seq<U>> . |
static <T,U> Future<Seq<U>> |
Future.traverse(Iterable<? extends T> values,
Function<? super T,? extends Future<? extends U>> mapper)
Maps the values of an iterable in parallel to a sequence of mapped values into a single
Future by
transforming an Iterable<? extends T> into a Future<Seq<U>> . |
Copyright © 2017. All Rights Reserved.