web123456

Reverse order traversal of Map

ListIterator<Map.Entry<Integer, List<Character>>> li = new ArrayList<>(map1.entrySet()).listIterator(map.size()); while(li.hasPrevious()) { // If there is any previous one, go ahead Map.Entry<Integer, List<Character>> entry = li.previous(); System.out.println(entry.getKey()+":"+entry.getValue()); }