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<? extends 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, wait
allOf, allOf, allOf, allOf, allPromisedValues, allPromisedValues, allPromisedValues, allPromisedValues
public static <T> PromisedValues<T> combineAllOf(java.util.List<? extends 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)
PromisedValues
PromisedValues
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()
PromisedValues
PromisedValues
has completed)isDone
in interface PromisedValues<T>
public java.lang.Throwable cause()
PromisedValues
cause
in interface PromisedValues<T>
public boolean succeeded(int index)
PromisedValues
CompletionStage
at the specified index succeededsucceeded
in interface PromisedValues<T>
index
- the index of the CompletionStage
public java.lang.Throwable cause(int index)
PromisedValues
cause
in interface PromisedValues<T>
index
- the index of the CompletionStage
public T get(int index)
PromisedValues
get
in interface PromisedValues<T>
index
- the index of the futurepublic java.util.List<T> toList()
PromisedValues
toList
in interface PromisedValues<T>
public int size()
size
in interface PromisedValues<T>
CompletionStage
s under the coverspublic java.util.List<T> join()
PromisedValues
CompletionException
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