1.去重
1. public static ArrayList<OrganizationInfoBO> removeDuplicteUsers(ArrayList<OrganizationInfoBO> listOrganizationInfoBo) { 2. Set<OrganizationInfoBO> setBo = new TreeSet<OrganizationInfoBO>(new Comparator<OrganizationInfoBO>() { 3. @Override 4. public int compare(OrganizationInfoBO o1, OrganizationInfoBO o2) { 5. return o1.getId().compareTo(o2.getId()); 6. } 7. }); 8. setBo.addAll(listOrganizationInfoBo); 9. return new ArrayList<OrganizationInfoBO>(setBo); 10. }
2.分组
1. Map<String, List<AttendRulesInfoBO>> group = resultBo(list对象). 2. stream().collect(Collectors.groupingBy 3. (AttendRulesInfoBO(list中VO)::getLateClass(VO中get方法)));
3.排序
1. //按照条码类别倒序,条码编码正序排列 2. Collections.sort(result, new Comparator<BarcodeManageVo>() { 3. @Override 4. public int compare(BarcodeManageVo bo1, BarcodeManageVo bo2) { 5. return bo2.getBatchCode().compareTo(bo1.getBatchCode()); 6. //String的逆序排列 7. } 8. });