Interface StateFuture<T>
-
- Type Parameters:
T- The return type of this future.
@Experimental public interface StateFuture<T>StateFuture is a future that act as a return value for async state interfaces. Note: All these methods of this interface can ONLY be called within task thread.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StateFuture<Void>thenAccept(ThrowingConsumer<? super T,? extends Exception> action)Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied action.<U> StateFuture<U>thenApply(FunctionWithException<? super T,? extends U,? extends Exception> fn)Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied function.<U,V>
StateFuture<V>thenCombine(StateFuture<? extends U> other, BiFunctionWithException<? super T,? super U,? extends V,? extends Exception> fn)Returns a new StateFuture that, when this and the other given future both complete normally, is executed with the two results as arguments to the supplied function.<U> StateFuture<U>thenCompose(FunctionWithException<? super T,? extends StateFuture<U>,? extends Exception> action)Returns a new future that, when this future completes normally, is executed with this future as the argument to the supplied function.
-
-
-
Method Detail
-
thenApply
<U> StateFuture<U> thenApply(FunctionWithException<? super T,? extends U,? extends Exception> fn)
Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied function.- Type Parameters:
U- the function's return type.- Parameters:
fn- the function to use to compute the value of the returned StateFuture.- Returns:
- the new StateFuture.
-
thenAccept
StateFuture<Void> thenAccept(ThrowingConsumer<? super T,? extends Exception> action)
Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied action.- Parameters:
action- the action to perform before completing the returned StateFuture.- Returns:
- the new StateFuture.
-
thenCompose
<U> StateFuture<U> thenCompose(FunctionWithException<? super T,? extends StateFuture<U>,? extends Exception> action)
Returns a new future that, when this future completes normally, is executed with this future as the argument to the supplied function.- Parameters:
action- the action to perform.- Returns:
- the new StateFuture.
-
thenCombine
<U,V> StateFuture<V> thenCombine(StateFuture<? extends U> other, BiFunctionWithException<? super T,? super U,? extends V,? extends Exception> fn)
Returns a new StateFuture that, when this and the other given future both complete normally, is executed with the two results as arguments to the supplied function.- Type Parameters:
U- the type of the other StateFuture's result.V- the function's return type.- Parameters:
other- the other StateFuture.fn- the function to use to compute the value of the returned StateFuture.- Returns:
- the new StateFuture.
-
-