Kotlin HashSet associateTo()
Syntax & Examples


Syntax of HashSet.associateTo()

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

fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateTo( destination: M, transform: (T) -> Pair<K, V> ): M

This associateTo() extension function of HashSet populates and returns the destination mutable map with key-value pairs provided by transform function applied to each element of the given collection.