📅  最后修改于: 2022-03-11 14:53:34.375000             🧑  作者: Mango
fun main() {
val numbers = listOf("zero", "one", "two", "three", "four")
val filteredIdx = numbers.filterIndexed { index, s -> (index % 2 == 0) }
println(filteredIdx) /* prints [zero, two, four] */
}
data class Student(val id: Long, val name: String)