Map遍历倒序输出
public static void main(String[] args) {
Map<String, String> map = new HashMap<String, String>();
map.put("a", "1");
map.put("b", "2");
map.put("c", "3");
ListIterator<Map.Entry<String, String>> li = new ArrayList<Map.Entry<String, String>>(map.entrySet()).listIterator(map.size());
while (li.hasPrevious()) {
Map.Entry<String, String> entry = li.previous();
System.out.println(entry.getKey() + ":" + entry.getValue());
}
}
参考文章:
http://www.manongjc.com/article/63179.html