forum

Home / DeveloperSection / Forums / swap keys and duplicate values in hashmap

swap keys and duplicate values in hashmap

Anonymous User 1629 22-Apr-2015
Hey Everyone,
I have interesting question on hash map and it says : 

I have a hash map with values : {"1-a","2-a","3-b","4-b"} 
Keys Values 
1 a 
2 a 
3 b 
4 b 

I need to swap the key values with losing the data , means the new hash map should be : 
Keys Values 
a 1,2 
b 3,4 

Can anyone suggest me the way to do this?

Updated on 22-Apr-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By