`onEachIndexed`?
# stdlib
e
onEachIndexed
?
h
Essentially, add
Indexed
version of all iterating methods. But you can already do this:
Copy code
val foo = listOf(1, 4, 5, "foo", false, 9)

fun bar(i: Int, it: Any): Any = ...

val bar = foo.withIndex().onEach { (i, it) ->
   bar(i, it)
}
k
It would be nice if
withIndex()
was a free operation but unfortunately it's not 😞
h
yeah :S