pavlospt
selectedChoices.mapIndexed { index, isSelected -> if (isSelected) index else -1 }.filter { it != -1 }
selectedChoices
true
.filter { it != -1}
marcinmoskala
listOf(true, true, false, true).withIndex().filter { it.value }.map { it.index } listOf(true, true, false, true).mapIndexedNotNull { index, v -> if(v) index else null }
A modern programming language that makes developers happier.