### Question:
Algorithm { static <E> Predicate<E> disjunction(final Predicate<E>... predicates) { return new Predicate<E>() { @Override public boolean test(E element) { boolean res = false; for (Predicate<E> predicate : predicates) { res |= predicate.test(element); } return res; } }; }  static ArrayList<E> findAll(Ite input, Predicate<E> predicate);  }### Answer:
@Test public void testDisjunction() { final AtomicBoolean pCheck1 = new AtomicBoolean(false), pCheck2 = new AtomicBoolean(false); Predicate<Integer> isEven = new Predicate<Integer>() { @Override public boolean test(Integer integer) { pCheck1.set(true); return (integer % 2) == 0; } }; Predicate<Integer> isGreaterThan42 = new Predicate<Integer>() { @Override public boolean test(Integer integer) { pCheck2.set(true); return integer > 42; } }; Predicate<Integer> isEvenOrGreaterThan42 = disjunction(isEven, isGreaterThan42); boolean result = isEvenOrGreaterThan42.test(1); assertThat("During evaluation, all checks should have been set", Arrays.asList(pCheck1.get(), pCheck2.get()), everyItem(is(true))); assertThat("The result should be false", result, is(false)); pCheck1.set(false); pCheck2.set(false); result = isEvenOrGreaterThan42.test(51); assertThat("During evaluation, all checks should have been set", Arrays.asList(pCheck1.get(), pCheck2.get()), everyItem(is(true))); assertThat("The result should be true", result, is(true)); }