2222 * also compose a {@link CompletableFuture} of that list of values via {@link #toCompletableFuture()}
2323 */
2424public interface PromisedValues <T > {
25+
2526 /**
2627 * Returns a new {@link PromisedValues} that is completed when all of
2728 * the given {@link CompletableFuture}s complete. If any of the given
@@ -31,7 +32,7 @@ public interface PromisedValues<T> {
3132 * @param cfs the {@link CompletableFuture}s to combine
3233 * @param <T> the type of values
3334 *
34- * @return a new CombinedFutures
35+ * @return a new PromisedValues
3536 */
3637 static <T > PromisedValues <T > allOf (List <CompletableFuture <T >> cfs ) {
3738 return PromisedValuesImpl .combineAllOf (cfs );
@@ -47,7 +48,7 @@ static <T> PromisedValues<T> allOf(List<CompletableFuture<T>> cfs) {
4748 * @param f2 the 2nd completable future
4849 * @param <T> the type of values
4950 *
50- * @return a new CombinedFutures
51+ * @return a new PromisedValues
5152 */
5253 static <T > PromisedValues <T > allOf (CompletableFuture <T > f1 , CompletableFuture <T > f2 ) {
5354 return PromisedValuesImpl .combineAllOf (asList (f1 , f2 ));
@@ -64,12 +65,13 @@ static <T> PromisedValues<T> allOf(CompletableFuture<T> f1, CompletableFuture<T>
6465 * @param f3 the 3rd completable future
6566 * @param <T> the type of values
6667 *
67- * @return a new CombinedFutures
68+ * @return a new PromisedValues
6869 */
6970 static <T > PromisedValues allOf (CompletableFuture <T > f1 , CompletableFuture <T > f2 , CompletableFuture <T > f3 ) {
7071 return PromisedValuesImpl .combineAllOf (asList (f1 , f2 , f3 ));
7172 }
7273
74+
7375 /**
7476 * Returns a new {@link PromisedValues} that is completed when all of
7577 * the given {@link CompletableFuture}s complete. If any of the given
@@ -82,12 +84,80 @@ static <T> PromisedValues allOf(CompletableFuture<T> f1, CompletableFuture<T> f2
8284 * @param f4 the 4th completable future
8385 * @param <T> the type of values
8486 *
85- * @return a new CombinedFutures
87+ * @return a new PromisedValues
8688 */
8789 static <T > PromisedValues allOf (CompletableFuture <T > f1 , CompletableFuture <T > f2 , CompletableFuture <T > f3 , CompletableFuture <T > f4 ) {
8890 return PromisedValuesImpl .combineAllOf (asList (f1 , f2 , f3 , f4 ));
8991 }
9092
93+
94+ /**
95+ * Returns a new {@link PromisedValues} that is completed when all of
96+ * the given {@link PromisedValues}s complete. If any of the given
97+ * {@link PromisedValues}s complete exceptionally, then the returned
98+ * {@link PromisedValues} also does so.
99+ *
100+ * @param cfs the list to combine
101+ * @param <T> the type of values
102+ *
103+ * @return a new PromisedValues
104+ */
105+ static <T > PromisedValues <T > allPromisedValues (List <PromisedValues <T >> cfs ) {
106+ return PromisedValuesImpl .combinePromisedValues (cfs );
107+ }
108+
109+ /**
110+ * Returns a new {@link PromisedValues} that is completed when all of
111+ * the given {@link PromisedValues}s complete. If any of the given
112+ * {@link PromisedValues}s complete exceptionally, then the returned
113+ * {@link PromisedValues} also does so.
114+ *
115+ * @param pv1 the 1st promised value
116+ * @param pv2 the 2nd promised value
117+ * @param <T> the type of values
118+ *
119+ * @return a new PromisedValues
120+ */
121+ static <T > PromisedValues <T > allPromisedValues (PromisedValues <T > pv1 , PromisedValues <T > pv2 ) {
122+ return PromisedValuesImpl .combinePromisedValues (asList (pv1 , pv2 ));
123+ }
124+
125+ /**
126+ * Returns a new {@link PromisedValues} that is completed when all of
127+ * the given {@link PromisedValues}s complete. If any of the given
128+ * {@link PromisedValues}s complete exceptionally, then the returned
129+ * {@link PromisedValues} also does so.
130+ *
131+ * @param pv1 the 1st promised value
132+ * @param pv2 the 2nd promised value
133+ * @param pv3 the 3rd promised value
134+ * @param <T> the type of values
135+ *
136+ * @return a new PromisedValues
137+ */
138+ static <T > PromisedValues <T > allPromisedValues (PromisedValues <T > pv1 , PromisedValues <T > pv2 , PromisedValues <T > pv3 ) {
139+ return PromisedValuesImpl .combinePromisedValues (asList (pv1 , pv2 , pv3 ));
140+ }
141+
142+ /**
143+ * Returns a new {@link PromisedValues} that is completed when all of
144+ * the given {@link PromisedValues}s complete. If any of the given
145+ * {@link PromisedValues}s complete exceptionally, then the returned
146+ * {@link PromisedValues} also does so.
147+ *
148+ * @param pv1 the 1st promised value
149+ * @param pv2 the 2nd promised value
150+ * @param pv3 the 3rd promised value
151+ * @param pv4 the 4th promised value
152+ * @param <T> the type of values
153+ *
154+ * @return a new PromisedValues
155+ */
156+ static <T > PromisedValues <T > allPromisedValues (PromisedValues <T > pv1 , PromisedValues <T > pv2 , PromisedValues <T > pv3 , PromisedValues <T > pv4 ) {
157+ return PromisedValuesImpl .combinePromisedValues (asList (pv1 , pv2 , pv3 , pv4 ));
158+ }
159+
160+
91161 /**
92162 * When the all the futures complete, this call back will be invoked with this {@link PromisedValues} as a parameter
93163 *
@@ -169,11 +239,14 @@ static <T> PromisedValues allOf(CompletableFuture<T> f1, CompletableFuture<T> f2
169239 * (unchecked) {@link CompletionException} with the underlying
170240 * exception as its cause.
171241 *
242+ * @return the list of completed values similar to {@link #toList()}
243+ *
172244 * @throws CancellationException if the computation was cancelled
173245 * @throws CompletionException if this future completed
174246 * exceptionally or a completion computation threw an exception
247+ *
175248 */
176- void join ();
249+ List < T > join ();
177250
178251 /**
179252 * @return this as a {@link CompletableFuture} that returns the list of underlying values
0 commit comments