public final class ExtraPromises
extends java.lang.Object
Promise.
Provides helper methods for coordinating multiple promises.| Modifier and Type | Method and Description |
|---|---|
static <T> Promise<T> |
firstCompletedOf(Scheduler scheduler,
Promise<T>... promises)
Returns a new promise which completes upon the first completion of any promise.
|
static Promise<java.lang.Void> |
whenAll(Scheduler scheduler,
Promise<?>... promises)
Returns a new promise which waits for the successful completion of all provided promises.
|
static <T,U> Promise<Pair<T,U>> |
zip(Scheduler scheduler,
Promise<T> tPromise,
Promise<U> uPromise)
Zips two promises into one promise.
|
public static <T> Promise<T> firstCompletedOf(Scheduler scheduler, Promise<T>... promises)
T - The type of the value promised to be available now, or in the future, or never.scheduler - The scheduler under which to operate.promises - The promises to wait upon.public static Promise<java.lang.Void> whenAll(Scheduler scheduler, Promise<?>... promises)
scheduler - The scheduler under which to operate.promises - The promises to wait upon.public static <T,U> Promise<Pair<T,U>> zip(Scheduler scheduler, Promise<T> tPromise, Promise<U> uPromise)
T - The left type.U - The right type.scheduler - The scheduler under which to operate.tPromise - The left promise to zip.uPromise - The right promise to zip.