spring-framework / org.springframework.util.comparator / CompoundComparator / setComparator

setComparator

open fun setComparator(index: Int, comparator: Comparator<out T>): Unit

Replace the Comparator at the given index.

The Comparator will default to ascending sort order, unless it is a InvertibleComparator.

Parameters

index - the index of the Comparator to replace

comparator - the Comparator to place at the given index

See Also
InvertibleComparator

open fun setComparator(index: Int, comparator: Comparator<T>, ascending: Boolean): Unit

Replace the Comparator at the given index using the given sort order.

Parameters

index - the index of the Comparator to replace

comparator - the Comparator to place at the given index

ascending - the sort order: ascending (true) or descending (false)