// test parameter is a bounded wildcard type (Item 28) private static void test2(Collection<? extends Operation> opSet, double x, double y) { for (Operation op : opSet) System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y)); }
// test parameter is a bounded type token (Item 29) private static <T extends Enum<T> & Operation> void test(Class<T> opSet, double x, double y) { for (Operation op : opSet.getEnumConstants()) System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y)); }