1.完整版
list.sort(new Comparator<Student>() {@Overridepublic int compare(Student o1, Student o2) {/*** 自定义比较函数* 返回 -1 为真, 0 为假的*/return o1.getStudentMark() > o2.getStudentMark() ? -1 : 0;}});
2.阿里建议的简写
list.sort((o1, o2) -> o1.getStudentMark() > o2.getStudentMark() ? -1 : 0);