I have a list in Kotlin. I need to create a map from every element of the list, to an empty mutable set, something like this -
var mutableMap: MutableMap<Int, MutableSet<Int>> = mutableMapOf(someList.map{ it to mutableSetOf<Int>() })
But I'm getting this error -
Type mismatch.
Required:
Pair<TypeVariable(K), TypeVariable(V)>
Found:
List<Pair<Int, MutableSet<Int>>>
I know that mutableMapOf() accepts varargs pairs, so I tried the spread operator (*), but that also didnt work. Please help me achieve the result.