### Question:
ChainFunction implements Function<T, T> { @Override public T apply(T input) { T result = input; for (Function<? super T, ? extends T> f : myFunctions) { result = f.apply(result); } return result; } ChainFunction(Collection<? extends Function<? super T, ? extends T>> functions);  ChainFunction(Function<? super T, ? extends T> arg1, Function<? super T, ? extends T> arg2); @Override T apply(T input);  }### Answer:
@Test public void test() { Function<? super Integer, ? extends Integer> plusFive = new Function<Integer, Integer>() { @Override public Integer apply(Integer t) { return Integer.valueOf(t.intValue() + 5); } }; Function<? super Integer, ? extends Integer> timesThree = new Function<Integer, Integer>() { @Override public Integer apply(Integer t) { return Integer.valueOf(t.intValue() * 3); } }; Assert.assertEquals(Integer.valueOf(36), new ChainFunction<Integer>(plusFive, timesThree).apply(Integer.valueOf(7))); Assert.assertEquals(Integer.valueOf(26), new ChainFunction<Integer>(timesThree, plusFive).apply(Integer.valueOf(7))); Assert.assertEquals(Integer.valueOf(31), new ChainFunction<Integer>( Arrays.<Function<? super Integer, ? extends Integer>>asList(timesThree, plusFive, plusFive)) .apply(Integer.valueOf(7))); }