Liste Kotlin Split par prédicat
fun main() {
val asha = Student(101, "Asha", "IT")
val john = Student(102, "John", "Mechanic")
val afra = Student(103, "Afra", "Bio")
val kyle = Student(104, "Kyle", "IT")
val studentList = listOf(asha, john, afra, kyle)
val (itDept, others) = studentList.partition {
student -> student.dept.equals("IT")
}
println(itDept)
println(others)
}
data class Student(val id: Long, val name: String, val dept: String)
Smoggy Snail