reverse<T> function
Returns a comparator that imposes the reverse ordering of this comparator.
Implementation
Comparator<T> reverse<T>(Comparator<T> comparator) {
int compareTo(T a, T b) => comparator(b, a);
return compareTo;
}