@Test public void testCombine() { Consumer<Integer> work1 = createMock(INT_CLOSURE_CLZ); Consumer<Integer> work2 = createMock(INT_CLOSURE_CLZ); @SuppressWarnings("unchecked") Consumer<Integer> wrapper = Consumers.combine(ImmutableList.of(work1, work2)); work1.accept(1); work2.accept(1); work1.accept(2); work2.accept(2); control.replay(); wrapper.accept(1); wrapper.accept(2); }
public static <T> Consumer<T> combine(List<Consumer<T>> consumers) { checkNotNull(consumers); checkArgument(Iterables.all(consumers, Predicates.notNull())); return consumers.stream().reduce(noop(), Consumer::andThen); }
Consumers { public static <T> Consumer<T> combine(List<Consumer<T>> consumers) { checkNotNull(consumers); checkArgument(Iterables.all(consumers, Predicates.notNull())); return consumers.stream().reduce(noop(), Consumer::andThen); } }
Consumers { public static <T> Consumer<T> combine(List<Consumer<T>> consumers) { checkNotNull(consumers); checkArgument(Iterables.all(consumers, Predicates.notNull())); return consumers.stream().reduce(noop(), Consumer::andThen); } private  Consumers(); }
Consumers { public static <T> Consumer<T> combine(List<Consumer<T>> consumers) { checkNotNull(consumers); checkArgument(Iterables.all(consumers, Predicates.notNull())); return consumers.stream().reduce(noop(), Consumer::andThen); } private  Consumers(); static Consumer<T> combine(List<Consumer<T>> consumers); static Consumer<T> filter(final Predicate<T> filter, final Consumer<T> consumer); @SuppressWarnings("unchecked") static Consumer<T> noop(); }
Consumers { public static <T> Consumer<T> combine(List<Consumer<T>> consumers) { checkNotNull(consumers); checkArgument(Iterables.all(consumers, Predicates.notNull())); return consumers.stream().reduce(noop(), Consumer::andThen); } private  Consumers(); static Consumer<T> combine(List<Consumer<T>> consumers); static Consumer<T> filter(final Predicate<T> filter, final Consumer<T> consumer); @SuppressWarnings("unchecked") static Consumer<T> noop();  }