I want to map Map<DAO, Int> to Map<String, Boolean> , but I cannot return Map.Entry to the map function:
itemsWithQuantity.mapTo(mutableMapOf<String, Boolean>(), { it.key.toString() to it.value != 0 })
(of course, I use a more complex display function, but that doesn't matter, the problem is the same)
It says
MutableMap<String, Boolean> is not a subtype of MutableCollection<Pair<String, Boolean>>.
So how can I return Map.Entry instead of a pair?
Now I do this:
val detailsIds = mutableMapOf<String, Boolean>() itemsWithQuantity.forEach { item, quantity -> detailsIds.put(it.key.toString(), it.value != 0) }
But I want to use mapTo
source share