标签:io ar sp java on cti bs as new
public List compareTo(List<Object> result)throws Exception{ Collections.sort(result,new Comparator<Object>(){ public int compare(Object arg0, Object arg1) { if(arg0.getNumber()>arg1.getNumber()){ return 1; }else if(arg0.getNumber()<arg1.getNumber()){ return -1; }else{ return 0; } } }); return result; }
这里假设 Object 对象里有number 属性,对number 进行排序;
List result = compareTo(list);
标签:io ar sp java on cti bs as new
原文地址:http://my.oschina.net/return/blog/348530