https://kotlinlang.org logo
Title
m

menegatti

01/25/2018, 3:21 PM
maybe
val frameDurationArray = IntArray(frames + 1) { animation?.getDuration(it)!! }
val duration = frameDurationArray.sum()
n

nickk

01/25/2018, 3:25 PM
Interesting, I can easily use
reduce
by creating an Array like you do… Thanks!
d

drako

01/25/2018, 3:56 PM
strange, I can call reduce on a range, as ranges are Iterable and reduce is defined for Iterable
n

nickk

01/29/2018, 2:37 PM
@drako You are right. I missed the last one here: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/reduce.html Still, I am not sure why
reduce
did not appear in AS auto-complete. Perhaps I did not put my range inside parentheses.