要复制HashMap
到的语句序列TreeMap
private Map<String,Bitmap> imageFilexx= new HashMap<String,Bitmap>();
//Assuming map has values
printMap(imageFilexx);
TreeMap<String,Bitmap> imageFilexxS;
imageFilexxS= new TreeMap<String,Bitmap>(imageFilexx);
printMap(imageFilexxS);
在地图上方显示的功能:
public static void printMap(Map<String, Bitmap> map) {
for (Map.Entry entry : map.entrySet()) {
System.out.println("Key : " + entry.getKey());
}
}
输入:
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p7.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p1.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p5.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p3.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p11.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p9.png
当前 O/P:
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p1.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p11.png //11 should be displayed in the last
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p3.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p5.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p7.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p9.png
预期的 O/P:
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p1.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p3.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p5.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p7.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p9.png
Key : http://myserver.com/myfolder/ImageDesc/ImageDesc%20p11.png