public static <E extends Comparable> E min(E[] a) { E smallest = a[0]; for (int i = 1; i < a.length; i++) if (a[i].compareTo(smallest) < 0) smallest = a[i]; return smallest; }
Can call min with a String[] array but not
with a Rectangle[] array
Comparable bound necessary for calling compareTo
Otherwise, min method would not have compiled