public static void main(String[] args) {
Map<Integer,String> map = new LinkedHashMap<>();
map.put(1, "a");
map.put(2, "b");
map.put(3, "c");
ListIterator<Map.Entry<Integer,String>> i = new ArrayList<>(map.entrySet()).listIterator(map.size());
while(i.hasPrevious()) {
Map.Entry<Integer, String> entry=i.previous();
System.out.println(entry.getKey()+":"+entry.getValue());
}
}
java对map进行倒序排列
最新推荐文章于 2024-02-05 08:59:26 发布