i want to filter the list
# getting-started
o
i want to filter the list
n
you want to filter the map so that only values (list) that contain the items are in the result ? or do you want to
map
over it filtering the lists ? for the former:
map.filterValues { it.any { searchQuery == it.propertyName}}
for the latter:
Copy code
map.mapValues { (key, list) -> 
    list.filter { searchQuery == it.propertyName }
}
or similar
o
filter the list inside the map for values that match a criteria, and then if one of the lists that belong to a key was empty after this previous filtering for criteria, that key must also be removed
n
Copy code
val filteredMap = map.mapValues { (key, list) -> 
    list.filter { searchQuery == it.propertyName }
}
.filterValues { it.isNotEmpty() }
maybe something like that ?