代码
List<HTjfxFltjNew> hTjfxFltjNews = new ArrayList<>();
Collections.sort(hTjfxFltjNews, new Comparator<HTjfxFltjNew>() {
@Override
public int compare(HTjfxFltjNew o1, HTjfxFltjNew o2) {
return Integer.parseInt(o2.getCjzs())-Integer.parseInt(o1.getCjzs());//降序,升序反过来
}
});
hTjfxFltjNews为对象 Cjzs为字段
上述代码中,在集合内将按照 hTjfxFltjNews类中的Cjzs字段进行降序排序