list对象属性排序

Collections.sort(list, new Comparator<ScRel>() {
    @Override
    public int compare(Object o1, Object o2) {
        if(o1.getScore() < o2.getScore()){//降序
            return 0;
        }else{
            return 1;
        }
    }
});

  

原文地址:https://www.cnblogs.com/dfdi33/p/6110972.html