I was doing a research let say I have below array list
List list=new ArrayList();
list.add(1);
list.add(1);
list.add(2);
list.add(3);
list.add(3);
Now as I can see the elements repeated in the list are 1 and 3 , now I want to create hashMap
Map hm = new HashMap();
and now in this HashMap I want key should be 1 and 3 and values should be 2 and 2 that is key 1 should have value 2 and key 3 should have value 2 that is the number of times is repeated is should be the value and the element that is repeated is to be stored as key Please advise how to achieve this..!