dictionary - Intersection of java.util.Map -
is there method in java.util.map
or util perform intersection on 2 maps? (to intersect 2 maps "keys")
i not able find any. can implement own intersection logic, hoping there operation in 1 of java.util.*
classes this.
how about:
map map1 = ...; map map2 = ...; map result = new ...(map1); result.keyset().retainall(map2.keyset());
or:
map map1 = ...; map map2 = ...; set result = new ...(map1.keyset()); result.retainall(map2.keyset());
Comments
Post a Comment