As above
data class Person(val name: String, val age: Int) : Comparable<Person> {
override fun compareTo(other: Person): Int {
return compareValuesBy(this, other, Person::name, Person::age)
}
}
The above code is running correctly, when I convert to the following code, I can't get the correct result.
data class Person(val name: String, val age: Int) : Comparable<Person> {
override fun compareTo(other: Person): Int {
return compareValuesBy(this, other, { name }, { age })
}
}