ListFunctions { public static <T, R> List<R> map(final Iterable<T> things, final Function<T, R> f) { List<R> returners = new LinkedList<R>(); for (T thing: things) { returners.add(f.call(thing)); } return returners; } private  ListFunctions(); static List<R> map(final Iterable<T> things, final Function<T, R> f);  }
@Test public void testMap() { List<String> names = Arrays.asList("joe", "carol", "anne-marie"); List<Integer> lengths = ListFunctions.map(names, new GetLengths()); assertEquals(lengths, Arrays.asList(3, 5, 10)); }