java how to combine two hashmap without duplicate entries -
I am trying to combine two different hamsters but in those two maps, there are some duplicate entries, so I combine After thoese entries will be removed. For example:
Hashmap 1:
100 Hello = 101 Good
Hashmap 2:
100 Hello < / P>
100 Hello = 101 Good-- 102 Good
I have tried putall
, but it seems that it does not remove duplicate entries Can I help it on a faster way?
I do not see a problem in your approach.
Hashmap
output
{102 = well, 101 = well, 100 = hello}
, If your Hashmap operation is correct.
Comments
Post a Comment