/** * Transform the input futures into a single future, using the provided * transform function. The transformation follows the same semantics as as * {@link Futures#transformAsync(ListenableFuture, AsyncFunction, Executor)} and the input * futures are combined using {@link Futures#allAsList}. * * @param a a ListenableFuture to combine * @param b a ListenableFuture to combine * @param c a ListenableFuture to combine * @param d a ListenableFuture to combine * @param e a ListenableFuture to combine * @param function the implementation of the transform * @return a ListenableFuture holding the result of function.apply() */ public static <Z, A, B, C, D, E> ListenableFuture<Z> asyncTransform5( ListenableFuture<A> a, ListenableFuture<B> b, ListenableFuture<C> c, ListenableFuture<D> d, ListenableFuture<E> e, final AsyncFunction5<Z, ? super A, ? super B, ? super C, ? super D, ? super E> function, final Executor executor) { return transform( Arrays.asList(a, b, c, d, e), (AsyncFunction<List<Object>, Z>) results -> function.apply( (A) results.get(0), (B) results.get(1), (C) results.get(2), (D) results.get(3), (E) results.get(4)), executor); }