Best way to sum all values of a SparseIntArray
What is the best way to sum all the values of a SparseIntArray in Kotlin ?
I try something but it's not working...
This is my code (quantities is the SparseIntArray) :
var amount = 0
for (q in quantities){
amount += q
}
But I have this error :
For loop range must have an 'iterator()' method
Be careful : my problem don't concern ArrayList but SparseIntArray.