byOrdered
fun <Target, Element> Order.Companion.byOrdered(vararg selectors: (Target) -> Element): Order<Target>(source)
Creates an Order instance that compares elements of type Target by comparing the results of applying the provided selectors to each element.
The comparison is performed lexicographically: the first selector that produces a non-equal comparison result determines the overall result.
Receiver
The order companion object.
Return
An Order instance that compares Target elements by their selected Element values.
Context Parameters
The order context for the element type.
Parameters
The sequence of selector functions to apply to elements before comparison.
Type Parameters
The type of elements to be ordered.
The type of values produced by the selectors.
fun <Target, Element> Comparator.Companion.byOrdered(vararg selectors: (Target) -> Element): Comparator<Target>(source)
Creates a comparator using the sequence of functions to calculate a result of comparison. The functions are called sequentially, receive the given values a and b and return objects comparable via Order context receiver. As soon as the instances returned by a function for a and b values do not compare as equal, the result of that comparison is returned from the Comparator. Otherwise 0 is returned.
Such order is usually called lexicographic order with respect to the provided orders.
Receiver
The comparator companion object.
Return
A Comparator that compares Target elements by their selected Element values.
Context Parameters
The order context for the element type.
Parameters
The sequence of selector functions to apply to elements before comparison.
Type Parameters
The type of elements to be compared.
The type of values produced by the selectors.