Simple extension method for Kotlin. Should perform an action on every element in a 2d array. i.e. An array of arrays.
I have made the assumption that because the receiver type is defined as an array of arrays of type T, that I do not need to do any checks or casts.
fun <T> Array<Array<T>>.forEach2d(action: (T) -> Unit): Unit {
for (outer in this) {
for (inner in outer) {
action(inner)
}
}
}