I use the code to Sort the data in the map.
Map<Integer, Integer> map = new HashMap<>();
List list = new ArrayList(map.entrySet());
Collections.sort(list, new Comparator<Map.Entry<Integer, Integer>>() {
@Override
public int compare(Map.Entry<Integer, Integer> a, Map.Entry<Integer, Integer> b) {
return a.getValue() - b.getValue();
}
});
I just copy the data from map to List and sort it. How can I get the data from the List? The method get() of list returns just the object, not my 2 integers