Kotlin, How do I make a function for distinctBy method
Suppose, I have this list which contains a list of employee info.
val distinctEmployee = employees.distinctBy { it.firstName }
I want to make a function and pass as a parameter for distinctBy method so I can apply any kind of distinct method to the list. I expect something like this.
val highSalaryEmployee = employees.filterBy(salaryFilter)
function salaryFilter(employee: Employee): Boolean {
return employee.salary > 350000
}
I have done this with filterBy method before, but I dont know...