toComparator method

Comparator<T> toComparator()

Returns a Comparator that tries each of the comparators in this iterable in order and returns the first result that doesn't end up in a tie.

Implementation

Comparator<T> toComparator() => (a, b) {
  for (final comparator in this) {
    final result = comparator(a, b);
    if (result != 0) return result;
  }
  return 0;
};