Kotlin HashMap onEachIndexed()
Syntax & Examples


Syntax of HashMap.onEachIndexed()

The syntax of HashMap.onEachIndexed() extension function is:

fun <K, V, M : Map<out K, V>> M.onEachIndexed( action: (index: Int, Entry<K, V>) -> Unit ): M

This onEachIndexed() extension function of HashMap performs the given action on each entry, providing sequential index with the entry, and returns the map itself afterwards.