Example 5.178. Multi-order sorting
::CLASS 'DescendingComparator' MIXINCLASS Comparator ::METHOD compare use strict arg left, right return -left~compareTo(right)
Example 5.179. Descending compare sorting
myArray = .array~of("Zoe", "Fred", "Xavier", "Andy") myArray~sortWith(.DescendingComparator~new) do name over myArray say name end
Example 5.180. Custom compare sorting
::CLASS EmployeeNameSorter MIXINCLASS Comparator ::METHOD compare use strict arg left, right return left~name~compareTo(right~name) -- do the comparison using the names