Check if keys of hashmap is equal to or a subset of another hashmap's keys

This is a set implementation written on top of std hash maps, there is also a supersetOf function. It seems to just iterate over all elements and check whether one set contains the other. I can’t really think of a more efficient way to do this, of course there could be optimizations if you can presuppose some things about your data.
If this is a common use case for you I’d also think about using ArrayHashMap since it offers cheaper iteration.

Also have a look at this short talk by Andrew about programming without pointers. He’s using a string table as an example there, I don’t know what exactly you’re trying to implement but it could help :slight_smile:

2 Likes