Find intersection/union between two maps
793241Sep 14 2011 — edited Sep 14 2011Hello.
I'm trying to find out state changes between two maps.
I have two maps A and B, what I need to do is to find keys in A that doesn't exists in B and keys in B that doesn't exist in A.
If keys exists in both A and B I want to compare the values of those keys.
What would be the most effective way to implement this.
My first plan was to loop through the keys in A to find in B and loop through keys in B and find in A but I guess there is a more effective algorithm.
I'm also thinking about using java.util.Collections to find intersection/union between the keys in the maps but then I need to do a lookup in both
maps.
Any suggestions?
Regards
/Fredrik