# thenComparing method

Comparator<T> thenComparing(

1. Comparator<T> other

)

Chains another comparator to be used if this comparator returns 0 (equality).

If `compare(a, b)` returns 0, the `other` comparator will be used.

### Example

    final byLength = Comparator.comparing((s) => s.length);
    final thenAlpha = byLength.thenComparing(Comparator.naturalOrder<String>());

    final list = ['foo', 'bar', 'baz'];
    list.sort(thenAlpha.compare);
    print(list); // [bar, baz, foo]

## Implementation

    Comparator<T> thenComparing(Comparator<T> other) => _ChainedComparator(this, other);