Hashmap排序相关问题!谢谢!
我在hashmap里保存如下内容:
class content{
String id ;
String name;
int order;
public content(){
this.id =id
this.name=name;
this.order=order;
}
}
HashMap hm= new HashMap();
hm.put( "1 ",new content( "1 ", "张三 ",2));
hm.put( "2 ",new content( "2 ", "张四 ",1));
hm.put( "3 ",new content( "3 ", "张五 ",3));
我想问一下,现在如何我想换content对像中的order排序输出,有没有好办法啊?
谢谢各位啊!
------解决方案--------------------hashmap不支持排序,
你可以用sortmap