用Collections升降排序
//期末从业人员 总收入 资产总计等 升降 排序 if("qmcyry".equals(sss)){ if("desc".equals(orders)){ Collections.sort(sjsReportDistributionPageList, new Comparator<SjsReportDistributionPage>() { @Override public int compare(SjsReportDistributionPage user1, SjsReportDistributionPage user2) { int zsr1 = Integer.parseInt(user1.getQmcyry()); int zsr2 = Integer.parseInt((user2.getQmcyry())); return zsr1>zsr2?-1:1; } }); }else if("asc".equals(orders)){ Collections.sort(sjsReportDistributionPageList, new Comparator<SjsReportDistributionPage>() { @Override public int compare(SjsReportDistributionPage user1, SjsReportDistributionPage user2) { int zsr1 = Integer.parseInt(user1.getQmcyry()); int zsr2 = Integer.parseInt((user2.getQmcyry())); return zsr1>zsr2?1:-1; } }); } }
项目中用到的,获取排序字段,用底层算法比对排序。
博主 Email:32595667@139.com QQ:32595667