The Comparator class is the base class for implementing Comparator objects that can be used with the Array sortWith() (
Section 5.3.6.35, “sortWith”) or stableSortWith() method (
Section 5.3.6.37, “stableSortWith”). The compare() method implements some form of comparison that determines the relative ordering of two objects. Many Comparator implementations are specific to particular object types.