### Question:
Algorithm { static <A, B, C> Function<A, C> compose(final Function<B, C> f, final Function<A, B> g) { return new Function<A, C>() { @Override public C execute(A value) throws Throwable { return f.execute(g.execute(value)); } }; }  static ArrayList<E> findAll(Ite input, Predicate<E> predicate);  }### Answer:
@Test public void testCompose() { final AtomicBoolean fCheck1 = new AtomicBoolean(false), fCheck2 = new AtomicBoolean(false); Function<Integer, Boolean> composed = compose(new Function<String, Boolean>() { @Override public Boolean execute(String value) { fCheck2.set(fCheck1.get()); return value.length() < 3; } }, new Function<Integer, String>() { @Override public String execute(Integer value) { fCheck1.set(true); return value.toString(); } }); Boolean result = null; try { result = composed.execute(42); } catch (Throwable throwable) { fail("The function should not throw any exception"); } assertThat("The result should be true", result, is(true)); assertThat("During evaluation, the functions should have set checks to true", Arrays.asList(fCheck1.get(), fCheck2.get()), everyItem(is(true))); }