List对象排序

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013495063/article/details/52293972

List对象排序实例:

//排序
if(!CollectionUtil.isEmpty(showList)){
Collections.sort(showList, new Comparator<ShowVo>() {
public int compare(ShowVo arg0, ShowVo arg1) {
Date startDate = arg0.getDate();
Date endDate = arg1.getDate();
int has = DateUtils.getDaysByTwoDate(startDate, endDate);
if (has>0) { //倒序
return 1;
} else if (has==0) {
return 0;
} else {
return -1;
}
}
});
}
结果:
阅读更多

没有更多推荐了,返回首页