reverse<T> static method
Reverses a given comparator, that is, change it from ascending to descending or vice-versa.
Implementation
static Comparator<T> reverse<T>(Comparator<T> comparator) {
return (a, b) => -comparator(a, b);
}