Comparator

Common
JS
Native
1.0
inline fun <T> Comparator(
    crossinline comparison: (a: T, b: T) -> Int
): Comparator<T>

Creates a Comparator with the provided comparison function.

Parameters

comparison - function that compares its two arguments for order. Must return 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.

Return Comparator object with the provided implementation of the comparison function.