@Test(expected = TestException.class) public void collectMixedException() throws CheckedFutureException { Promise<Integer> p1 = Promise.apply(); Promise<Integer> p2 = Promise.apply(); Future<List<Integer>> future = Future.collect(Arrays.asList(p1, p2, Future.value(3))); p1.setValue(1); p2.setException(ex); Integer[] expected = { 1, 2, 3 }; assertArrayEquals(expected, get(future).toArray()); }
@SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } CollectPromise(final List<? extends Future<T>> list); }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } CollectPromise(final List<? extends Future<T>> list); @SuppressWarnings("unchecked") final void collect(final T value, final int i); }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } CollectPromise(final List<? extends Future<T>> list); @SuppressWarnings("unchecked") final void collect(final T value, final int i);  }