public class PromisedValuesImpl<T> extends java.lang.Object implements PromisedValues<T>
| Modifier and Type | Method and Description |
|---|---|
java.lang.Throwable |
cause()
The exception cause or null if it didn't fail
|
java.lang.Throwable |
cause(int index)
The exception cause at the specified index or null if it didn't fail
|
static <T> PromisedValues<T> |
combineAllOf(java.util.List<java.util.concurrent.CompletionStage<T>> cfs) |
static <T> PromisedValues<T> |
combinePromisedValues(java.util.List<PromisedValues<T>> promisedValues) |
boolean |
failed() |
T |
get(int index)
The value at index or null if it failed
|
boolean |
isDone()
The true if the all the futures have completed (and hence this
PromisedValues has completed) |
java.util.List<T> |
join()
Waits for the underlying futures to complete.
|
int |
size() |
boolean |
succeeded() |
boolean |
succeeded(int index)
The true if the
CompletionStage at the specified index succeeded |
PromisedValues<T> |
thenAccept(java.util.function.Consumer<PromisedValues<T>> handler)
When the all the futures complete, this call back will be invoked with this
PromisedValues as a parameter |
java.util.concurrent.CompletableFuture<java.util.List<T>> |
toCompletableFuture() |
java.util.List<T> |
toList()
Returns the underlying values as a list
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallOf, allOf, allOf, allOf, allPromisedValues, allPromisedValues, allPromisedValues, allPromisedValuespublic static <T> PromisedValues<T> combineAllOf(java.util.List<java.util.concurrent.CompletionStage<T>> cfs)
public static <T> PromisedValues<T> combinePromisedValues(java.util.List<PromisedValues<T>> promisedValues)
public PromisedValues<T> thenAccept(java.util.function.Consumer<PromisedValues<T>> handler)
PromisedValuesPromisedValues as a parameterthenAccept in interface PromisedValues<T>handler - the call back which will be given this objectPromisedValues which you can compose more computations withpublic boolean succeeded()
succeeded in interface PromisedValues<T>public boolean failed()
failed in interface PromisedValues<T>public boolean isDone()
PromisedValuesPromisedValues has completed)isDone in interface PromisedValues<T>public java.lang.Throwable cause()
PromisedValuescause in interface PromisedValues<T>public boolean succeeded(int index)
PromisedValuesCompletionStage at the specified index succeededsucceeded in interface PromisedValues<T>index - the index of the CompletionStagepublic java.lang.Throwable cause(int index)
PromisedValuescause in interface PromisedValues<T>index - the index of the CompletionStagepublic T get(int index)
PromisedValuesget in interface PromisedValues<T>index - the index of the futurepublic java.util.List<T> toList()
PromisedValuestoList in interface PromisedValues<T>public int size()
size in interface PromisedValues<T>CompletionStages under the coverspublic java.util.List<T> join()
PromisedValuesCompletionException with the underlying
exception as its cause.join in interface PromisedValues<T>PromisedValues.toList()public java.util.concurrent.CompletableFuture<java.util.List<T>> toCompletableFuture()
toCompletableFuture in interface PromisedValues<T>CompletableFuture that returns the list of underlying values