/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * successful input futures. The list of results is in the same order as the input list, and if * any of the provided futures fails or is canceled, its corresponding position will contain * {@code null} (which is indistinguishable from the future having a successful value of {@code * null}). * * <p>Canceling this future will attempt to cancel all the component futures. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta @SafeVarargs public static <V> ListenableFuture<List<V>> successfulAsList( ListenableFuture<? extends V>... futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), false); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * input futures, if all succeed. If any input fails, the returned future fails immediately. * * <p>The list of results is in the same order as the input list. * * <p>Canceling this future will attempt to cancel all the component futures, and if any of the * provided futures fails or is canceled, this one is, too. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta @SafeVarargs public static <V> ListenableFuture<List<V>> allAsList(ListenableFuture<? extends V>... futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), true); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * successful input futures. The list of results is in the same order as the input list, and if * any of the provided futures fails or is canceled, its corresponding position will contain * {@code null} (which is indistinguishable from the future having a successful value of {@code * null}). * * <p>Canceling this future will attempt to cancel all the component futures. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta @SafeVarargs public static <V> ListenableFuture<List<V>> successfulAsList(ListenableFuture<? extends V>... futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), false); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * input futures, if all succeed. If any input fails, the returned future fails immediately. * * <p>The list of results is in the same order as the input list. * * <p>Canceling this future will attempt to cancel all the component futures, and if any of the * provided futures fails or is canceled, this one is, too. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta public static <V> ListenableFuture<List<V>> allAsList( Iterable<? extends ListenableFuture<? extends V>> futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), true); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * successful input futures. The list of results is in the same order as the input list, and if * any of the provided futures fails or is canceled, its corresponding position will contain * {@code null} (which is indistinguishable from the future having a successful value of {@code * null}). * * <p>Canceling this future will attempt to cancel all the component futures. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta public static <V> ListenableFuture<List<V>> successfulAsList( Iterable<? extends ListenableFuture<? extends V>> futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), false); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * input futures, if all succeed. If any input fails, the returned future fails immediately. * * <p>The list of results is in the same order as the input list. * * <p>Canceling this future will attempt to cancel all the component futures, and if any of the * provided futures fails or is canceled, this one is, too. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta public static <V> ListenableFuture<List<V>> allAsList(Iterable<? extends ListenableFuture<? extends V>> futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), true); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * successful input futures. The list of results is in the same order as the input list, and if * any of the provided futures fails or is canceled, its corresponding position will contain * {@code null} (which is indistinguishable from the future having a successful value of {@code * null}). * * <p>Canceling this future will attempt to cancel all the component futures. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta public static <V> ListenableFuture<List<V>> successfulAsList(Iterable<? extends ListenableFuture<? extends V>> futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), false); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * input futures, if all succeed. * * <p>The list of results is in the same order as the input list. * * <p>Canceling this future will attempt to cancel all the component futures, and if any of the * provided futures fails or is canceled, this one is, too. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta @SafeVarargs public static <V> ListenableFuture<List<V>> allAsList(ListenableFuture<? extends V>... futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), true); }
/** * Creates a new {@code ListenableFuture} whose value is a list containing the values of all its * input futures, if all succeed. * * <p>The list of results is in the same order as the input list. * * <p>Canceling this future will attempt to cancel all the component futures, and if any of the * provided futures fails or is canceled, this one is, too. * * @param futures futures to combine * @return a future that provides a list of the results of the component futures * @since 10.0 */ @Beta public static <V> ListenableFuture<List<V>> allAsList( Iterable<? extends ListenableFuture<? extends V>> futures) { return new ListFuture<V>(ImmutableList.copyOf(futures), true); }