compose method

Comparator<T> compose(
  1. Comparator<T> then
)

return a new comparator, that sorts the items first by the criteria of this comparator, then by the criteria of the given comparator

Implementation

Comparator<T> compose(Comparator<T> then) {
  return (a, b) {
    final first = this(a, b);
    if (first != 0) {
      return first;
    }
    return then(a, b);
  };
}