Kotlin HashMap onEach()
Syntax & Examples


Syntax of HashMap.onEach()

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

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

This onEach() extension function of HashMap performs the given action on each entry and returns the map itself afterwards.