public List<JfApproveTestVo> comparatorScoreAscTest(List<JfApproveTestVo> jfAuctionList){ Collections.sort(jfAuctionList, new Comparator<JfApproveTestVo>() { /* * int compare(Student o1, Student o2) 返回一个基本类型的整型, * 返回负数表示:o1 小于o2, * 返回0 表示:o1和o2相等, * 返回正数表示:o1大于o2。 */ public int compare(JfApproveTestVo o1, JfApproveTestVo o2) {
if (o1.getJfAuction().getScore() < o2.getJfAuction().getScore()) { return 1; } if (o1.getJfAuction().getScore() == o2.getJfAuction().getScore()) { return 0; } return -1; } }); return jfAuctionList; }