Java如何根据对象某一属性值大小对列表进行排序呢?
下面介绍一种很傻瓜的排序
Collections.sort(someObjList, new Comparator<SomeObject>() {
public int compare(SomeObject s1, SomeObject s2) {
return s1.getProperties().compareTo(s2.getProperties());
}
});
这里定义的对象属性时int型的。