[Kotlin] for-loop with no additional object allocation

In Kotlin, we can use functions such as forEach, forEachIndexed, and map to iterate items in collection. It’s convenient to use, but it comes with cost; those functions create additional objects like Iterator. For most cases, it wouldn’t be a serious problem to have some temporary objects. However, when overriding onDraw method of View class, […]

[Kotlin] for-loop with no additional object allocation Read More »