Kotlin HashSet onEach()
Syntax & Examples


Syntax of HashSet.onEach()

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

fun <T, C : Iterable<T>> C.onEach(action: (T) -> Unit): C

This onEach() extension function of HashSet performs the given action on each element and returns the collection itself afterwards.