Comparable vs. Comparator

Report a typo

For the personnel accounting system, we need to write a class that contains information about employees: their name, age, and salary.
Which interface should we implement if we know that we need to implement a simple salary sorting?

data class Employee(val name: String, val age: Int, val salary: Int): ???
Enter a short text
___

Create a free account to access the full topic