[Kotlin] for-loop with no additional object allocation

Kotlin provides extension functions for Collection types such as forEach, forEachIndexed, and map. They are convenient 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, it’s prohibitted to allocate a […]

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