I have the following code:
val sum = list.itens.sumBy { item ->
when (item.intValueI == item.intValueII) {
true -> 1
else -> 0
}
}
Updating to Kotlin 1.5, I got the deprecated warning; How should I proceed to achieve the same functionality?
I tried below:
val result = list.itens.sumOf<ListItemClass> { item ->
val intValueI = item.value ?: 0
val intValueII = item.valueII ?: 0
when(item.intValueI == item.IntValueII){
true -> 1
else -> 0
}
}