Comparator<JrProjectBalanceDto> comparing = Comparator.comparing(JrProjectBalanceDto::getUsed).thenComparing( (o1, o2) -> { if (JrValidate.checkStringIsNumeric(o1.getCardCode()) && JrValidate.checkStringIsNumeric(o2.getCardCode())) { return Integer.valueOf(o1.getCardCode()) - Integer.valueOf(o2.getCardCode()); } else { return o1.getCardCode().compareTo(o2.getCardCode()); } }); list = list.stream().sorted(comparing).collect(Collectors.toList());
java多条件排序
最新推荐文章于 2024-04-07 15:36:45 发布