As per Java API spec, the signature of Collections.reverseOrder is
public static
And the example gi
Arrays.sort() knows what kind of Comparator it needs, since T
is specified by the first argument (a
):
public static void sort(T[] a, Comparator super T> c)
EDIT:
@Louis Wasserman correctly points out that we only need a Comparator super T>
, not a Comparator
. Since Object
is a superclass of any T
, then Comparator
(the default if no generic parameters are given) is sufficient.