higher-order functions in Java
List<Integer> input = Arrays.asList(new Integer[]{1, 2, 3, 4, 5}); Integer output = Functionals.foldr(new Function<Integer, Integer>() { @Override public Integer call(final Integer t1, final Integer t2) { return t1 + t2; } }, 0, input); System.out.println(String.format("Sum: %s", output));
(adrianwalker.org)
aus Delicious/steinhobelgruen