fun <T> compareValuesBy( a: T, b: T, vararg selectors: (T) -> Comparable<*>? ): Int
Compares two values using the specified functions selectors to calculate the result of the comparison. The functions are called sequentially, receive the given values a and b and return Comparable objects. As soon as the Comparable instances returned by a function for a and b values do not compare as equal, the result of that comparison is returned.
inline fun <T> compareValuesBy( a: T, b: T, selector: (T) -> Comparable<*>? ): Int
Compares two values using the specified selector function to calculate the result of the comparison. The function is applied to the given values a and b and return Comparable objects. The result of comparison of these Comparable instances is returned.
inline fun <T, K> compareValuesBy( a: T, b: T, comparator: Comparator<in K>, selector: (T) -> K ): Int
Platform and version requirements: JVM
inline fun <T, K> compareValuesBy( a: T, b: T, comparator: Comparator<in K>, selector: (T) -> K ): Int
Platform and version requirements: JS
Compares two values using the specified selector function to calculate the result of the comparison. The function is applied to the given values a and b and return objects of type K which are then being compared with the given comparator.
© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.comparisons/compare-values-by.html