forEachIndexed
Performs the given action on each element, providing sequential index with the element.
inline fun <T> Sequence<T>.forEachIndexed(action: (index: Int, T) -> Unit)(source)
val sequence = sequenceOf("apple", "banana", "cherry")
sequence.forEachIndexed { index, fruit ->
println("Index $index contains $fruit")
}