Returns a lexicographic-order comparator with another comparator.
Comparator considers two elements equal, i.e.
compare(a, b) == 0,
other is used to determine the order.
The returned comparator is serializable if the specified comparator is also serializable.
|the other comparator to be used when this comparator compares two objects that are equal.|
|if the argument is null.|
For example, to sort a collection of
String based on the length
and then case-insensitive natural ordering, the comparator can be
composed using following code,
Comparator<String> cmp = Comparator.comparingInt(String::length) .thenComparing(String.CASE_INSENSITIVE_ORDER);