Comparator (original) (raw)

Provides a comparison function for imposing a total ordering between instances of the type T.

Since Kotlin

1.0

Provides a comparison function for imposing a total ordering between instances of the type T.

Since Kotlin

1.8

Provides a comparison function for imposing a total ordering between instances of the type T.

Since Kotlin

1.8

Functions

Compares its two arguments for order. Returns zero if the arguments are equal, a negative number if the first argument is less than the second, or a positive number if the first argument is greater than the second.

Compares its two arguments for order. Returns zero if the arguments are equal, a negative number if the first argument is less than the second, or a positive number if the first argument is greater than the second.

Compares its two arguments for order. Returns zero if the arguments are equal, a negative number if the first argument is less than the second, or a positive number if the first argument is greater than the second.

Returns a comparator that imposes the reverse ordering of this comparator.

Combines this comparator and the given comparator such that the latter is applied only when the former considered values equal.

Creates a comparator comparing values after the primary comparator defined them equal. It uses the function to transform value to a Comparable instance for comparison.

Creates a comparator comparing values after the primary comparator defined them equal. It uses the selector function to transform values and then compares them with the given comparator.

Creates a descending comparator using the primary comparator and the function to transform value to a Comparable instance for comparison.

Creates a descending comparator comparing values after the primary comparator defined them equal. It uses the selector function to transform values and then compares them with the given comparator.

Creates a comparator using the primary comparator and function to calculate a result of comparison.

Combines this comparator and the given comparator such that the latter is applied only when the former considered values equal.

Thanks for your feedback!