interface Stringer { String stringify(Integer i); } Iterable<String> stringifyConvert(Iterable<Integer> x, Stringer s) { Collection<String> y = new LinkedList<String>(); for(Integer i : x) y.add(s.stringify(i)); return y; }
Then we passed in the two differing implementations of Stringer
for the two use cases.
But...