list排序:order
list排序:
//对list排序
@SuppressWarnings("rawtypes")
public void order(List<Room> list){
Collections.sort(list,new Comparator<Room>() {
@Override
public int compare(Room o1, Room o2) {
String str1=o1.getRname()==null?"0":o1.getRname();
String str2=o2.getRname()==null?"0":o2.getRname();
int num =Integer.valueOf(str1).compareTo(Integer.valueOf(str2));
return num;
}
});
}