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

addComparator

open fun addComparator(comparator: Comparator<out T>): Unit

Add a Comparator to the end of the chain.

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

Parameters

comparator - the Comparator to add to the end of the chain

See Also
InvertibleComparator

open fun addComparator(comparator: Comparator<out T>, ascending: Boolean): Unit

Add a Comparator to the end of the chain using the provided sort order.

Parameters

comparator - the Comparator to add to the end of the chain

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