import java.util.*;
class Higher {
interface Fun { // Interface für Objekte des funktionalen Typs,
B call (A arg); // welches eine call-Methode erfordert.
}
static List map (Fun f, List xs) {
List ys = new ArrayList (xs.size());
for (A x : xs) {
ys.add(f.call(x)); // Hier wird das Interface benötigt.
}
return ys;
}
public static void main (String[] args) {
List a = Arrays.asList(1,2,3,4,5);
a = map(x -> x * 3, a);
System.out.println(a);
}
}