Filter the elements of a map based on a subset of its keys without iterating through the entire thing

Viewed 29745

I have a Map<String, ArrayList> and a Set<String>. Is there a way to "intersect" the keys of the map with the set of strings such that only the pairs with the given key remain, without iterating over the entire map? My main concern is performance and re-inventing the wheel on something that can be done more elegantly.

2 Answers
Related