Collections.sort('传入你需要排序的集合;列如(List<TeacherAtten>)', new Comparator<TeacherAtten>() {
@Override
public int compare(TeacherAtten o1, TeacherAtten o2) {
// 根据属性进行排序
if (Long.parseLong(o1.getTime().replaceAll("-","")) > Long.parseLong(o2.getTime().replaceAll("-",""))) {
return 1;
}
if (Long.parseLong(o1.getTime().replaceAll("-","")) == Long.parseLong(o2.getTime().replaceAll("-",""))) {
return 0;
}
return -1;
}
});