Product Site

5.3.19.3. Builtin Comparators

Rexx includes a number of built-in Comparators for common sorting operations.
Comparator Class

Base comparator. The Comparator class just uses the compareTo method of the first argument to generate the result. Using sortWith and a Comparator instance is equivalent to using the sort method and no comparator.
CaselessComparator Class

Like the base comparator, but uses the caselessCompareTo method to determine order. The String class implements caselessCompareTo, so the CaselessComparator can be used to sort arrays of strings independent of case.
ColumnComparator Class

The ColumnComparator will sort string items using specific substrings within each string item. If sorting is performed on multiple column positions, the stableSortWith method is recommended to ensure the results of previous sort operations are retained.
CaselessColumnComparator Class

Like the ColumnComparator, but the substring comparisons are done independently of case.
DescendingComparator Class

The reverse of the Comparator class. The DescendingComparator can be used to sort items in descending order.
CaselessDescendingComparator Class

The reverse of the CaselessComparator class. The CaselessDescendingComparator can be used to sort items in descending order with comparisons done independently of case.
InvertingComparator Class

The InvertingComparator will invert the result returned by another Comparator instance. This comparator can be combined with another comparator instance to reverse the sort order.
NumericComparator Class

Performs comparisons of strings using numeric comparison rules. Use the NumericComparator to sort collections of numbers.