As per Java API spec, the signature of Collections.reverseOrder is
public static
And the example gi
T
is being resolved to Object
. This passes, since Arrays.sort(T[], Comparator super T>)
would accept a Comparator
, since Object
is a supertype of T
.
Eclipse confirms that Collections.reverseOrder()
is resolved to a Comparator
in the code
String[] array = new String[10];
Arrays.sort(array, Collections.reverseOrder());