public static function reverseOrder(Comparator $comparator = null) : Comparator
    {
        if ($comparator === null) {
            $comparator = ComparableComparator::instance();
        }
        return new ReverseComparator($comparator);
    }
public static function reverseOrder(Comparator $comparator = null) : Comparator
    {
        if ($comparator === null) {
            $comparator = ComparableComparator::instance();
        }
        return new ReverseComparator($comparator);
    }
Returns a comparator that imposes the reverse ordering of the specified comparator.

<p>
If the specified comparator is null, it returns a comparator that imposes the reverse of the natural ordering
on a collection of objects that implement the {@link Comparable} interface.
(The natural ordering is the ordering imposed by the objects' own compareTo method.)

<p>
This enables a simple idiom for sorting (or maintaining) collections (or arrays) of objects
that implement the {@link Comparable} interface in reverse-natural-order.
For example, suppose a is an array. Then:

<pre>
Arrays::sortWith(a, Collections::reverseOrder());
</pre>

sorts the array in reverse order.

@param Comparator $comparator
@return Comparator