I want to compare the each and every value in a java map with another value :  If a value matches with another value then, i want to get the key,value pair corresponding to that value into a new map and values that doesn't match i.e unique key,value pairs into another map.

Eg:

    Map<String,Double> map = new HashMap<String,Double>();
    
    map.put("First",123.12345); //data1
    map.put("Second",234.3456); //data2
    map.put("Third",576.9876); //data3
    map.put("Fourth",123.12345);//data4
    map.put("Fifth",234.3456); //data5
    map.put("Sixth",999.8888); //data6
    map.put("Seventh",677.4578); //data7

Now here (data1 and data4) values (data2 and data5) and  match and i want to store these (key,value) pairs in a new Map

Similarly data3, data and data7 have unique values and i want to store these (key,value) pairs in another new Map.

Any help is appreciated.....

Thanks in advance.....





