This message was deleted.
# announcements
s
This message was deleted.
t
You can define those fonctions as extensions of the original type, so that you define them once for all classes implementing that type :
fun <T> Iterable.forEach(action: (T) -> Unit)
But, why would you write your own implementation of
forEach
? It is already available as an extension function in the Kotlin stdlib, and not only for Java 8 : https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/for-each.html