reverse<T> function

Comparator<T> reverse<T>(
  1. Comparator<T> comparator
)

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;
}