public class PromisedValuesImpl<T> extends Object implements PromisedValues<T>
Modifier and Type | Method and Description |
---|---|
Throwable |
cause()
The exception cause or null if it didn't fail
|
Throwable |
cause(int index)
The exception cause at the specified index or null if it didn't fail
|
static <T> PromisedValues<T> |
combineAllOf(List<? extends CompletionStage<T>> cfs) |
static <T> PromisedValues<T> |
combinePromisedValues(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) |
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(Consumer<PromisedValues<T>> handler)
When the all the futures complete, this call back will be invoked with this
PromisedValues as a parameter |
CompletableFuture<List<T>> |
toCompletableFuture() |
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(List<? extends CompletionStage<T>> cfs)
public static <T> PromisedValues<T> combinePromisedValues(List<PromisedValues<T>> promisedValues)
public PromisedValues<T> thenAccept(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 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 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 List<T> toList()
PromisedValues
toList
in interface PromisedValues<T>
public int size()
size
in interface PromisedValues<T>
CompletionStage
s under the coverspublic List<T> join()
PromisedValues
CompletionException
with the underlying
exception as its cause.join
in interface PromisedValues<T>
PromisedValues.toList()
public CompletableFuture<List<T>> toCompletableFuture()
toCompletableFuture
in interface PromisedValues<T>
CompletableFuture
that returns the list of underlying valuesCopyright © 2017–2020. All rights reserved.