对list集合排序升序和降序使用sort()

Collections.sort(resultList, new Comparator<HealthRecordRepeat>() {

            @Override

            public int compare(HealthRecordRepeat o1, HealthRecordRepeat o2) {

                //return o1.para - o2.para;  //升序

                return Integer.parseInt(o2.getTargetb()) - Integer.parseInt(o1.getTargetb()); //降序

            }

        });

猜你喜欢

转载自blog.csdn.net/wgd930701/article/details/81249578
今日推荐