Some algorithms to sort any COLLECTION using an external comparator.
Elements are sorted using the order given by the comparator: large elements at the beginning of the collection, small at the
end (increasing order is implemented by class COLLECTION_SORTER).
Note that without setting a comparator (using set_comparator), collections won't get sorted.
How to use this expanded class :
local
sorter: COMPARATOR_COLLECTION_SORTER[INTEGER]
array: ARRAY[INTEGER]
do
array := <<1,3,2>>
sorter.set_comparator(agent my_comparator)
sorter.sort(array)
check
sorter.is_sorted(array)
end
...