I need to write a small snippet of code where I need to check contents of a map (key value) if it exists in another map , remove it from the map
E.g
Map1:
1=>obj1
2=>obj21
3=>obj3
4=>obj4
Other map Map2:
10=>obj10
20=>obj20
2=>obj2
30=>obj30
3=>obj3
The result of fun (Map1, Map2) after it executes it has the following ouput
Map2:
10=>obj10
2=>obj2
20=>obj20
30=>obj30
Is iterating over the smaller map and checking contents (key, value) is iterating over the smaller map and checking the key and contents in the bigger map the most efficient way to go about it.