Question : kotlin filterindexed
Answered by : smoggy-snail-soz6mfud8cd7
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)
Source : https://tedblob.com/kotlin-filter-list/ | Last Update : Sat, 13 Nov 21