then method

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

Combine comparators sequentially.

Creates a comparator which orders elements the same way as this comparator, except that when two elements are considered equal, the tieBreaker comparator is used instead.

Implementation

Comparator<T> then(Comparator<T> tieBreaker) => (T a, T b) {
      var result = this(a, b);
      if (result == 0) result = tieBreaker(a, b);
      return result;
    };