Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Find intersection/union between two maps

793241Sep 14 2011 — edited Sep 14 2011
Hello.
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
This post has been answered by 836548 on Sep 14 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 12 2011
Added on Sep 14 2011
11 comments
2,477 views