// Generics and static // where the type of the entire class is irrelevant. // old style without type checking public static void sort( Object[] a, Comparator c) { if ( a.length == 0 ) { ... } Object temp; int r = c.compare( a[0], a[1] ); } // New style with type checking. // Had we asked for Comparator<T> we would insist // on a comparator specifically for class T. // With Comparator<? super T> c) we also allow // more general Comparators, including ones designed // for Object. public static <T> void sort(T[] a, Comparator<? super T> c) { if ( a.length == 0 ) { ... } T temp; int r = c.compare( a[0], a[1] ); }