private static <V> ListenableFuture<List<V>> listFuture(
      ImmutableList<ListenableFuture<? extends V>> futures,
      boolean allMustSucceed, Executor listenerExecutor) {
    return new CombinedFuture<V, List<V>>(
        futures, allMustSucceed, listenerExecutor,
        new FutureCombiner<V, List<V>>() {
          @Override
          public List<V> combine(List<Optional<V>> values) {
            List<V> result = Lists.newArrayList();
            for (Optional<V> element : values) {
              result.add(element != null ? element.orNull() : null);
            }
            return Collections.unmodifiableList(result);
          }
        });
  }
private static < V > ListenableFuture < List < V > > listFuture ( ImmutableList < ListenableFuture < ? extends V > > futures , boolean allMustSucceed , Executor listenerExecutor ) { return new CombinedFuture < V , List < V > > ( futures , allMustSucceed , listenerExecutor , new FutureCombiner < V , List < V > > ( ) { @ Override public List < V > combine ( List < Optional < V > > values ) { List < V > result = Lists . newArrayList ( ) ; for ( Optional < V > element : values ) { result . add ( element != null ? element . orNull ( ) : null ) ; } return Collections . unmodifiableList ( result ) ; } } ) ; }
Used for {@link #allAsList} and {@link #successfulAsList}.