Kotlin HashSet toMap()
Syntax & Examples
Syntax of HashSet.toMap()
There are 2 variations for the syntax of HashSet.toMap() extension function. They are:
1.
fun <K, V> Iterable<Pair<K, V>>.toMap(): Map<K, V>
This extension function returns a new map containing all key-value pairs from the given collection of pairs.
2.
fun <K, V, M : MutableMap<in K, in V>> Iterable<Pair<K, V>>.toMap( destination: M ): M
This extension function populates and returns the destination mutable map with key-value pairs from the given collection of pairs.