欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jdk1.8新特性  

程序员文章站 2022-07-12 17:22:50
...
public static void main(String[] str){
       List<Integer> list = new ArrayList<>();
       list.add(1);
        list.add(4);
        list.add(3);
        list.add(5);
        list.add(15);
        list.add(10);

        list.sort((o1, o2) -> o2.compareTo(o1));

        Map<String,Integer> map = Maps.newHashMap();
        map.put("张三",98);
        map.put("李四",68);
        map.put("王五",88);
        map.put("赵六",91);
        map.put("马七",90);

        List<Map.Entry<String,Integer>> listMap = map.entrySet().stream().collect(Collectors.toList());
        listMap.sort((o1, o2) -> o1.getValue().compareTo(o2.getValue()));
      System.out.println(listMap);
    }


    List<AccountantGroup> tempGroups = accountantGroups.stream()
                    //过滤掉不匹配的分组,depId, ouCode, categoryCode
                    .filter(accountantGroup -> hasMatchedGroupWork(accountantGroup.getAccountantGroupWork(), claimHeadDto))
                    //过滤掉已达最大处理的分组
                    .filter(accountantGroup -> getMaxGroup(accountantGroup, map))
                    .collect(toList());
List<AccountantGroup> result;

AccountantGroup accountantGroup = Optional.ofNullable(result)
                .orElse(new ArrayList<>())
                .stream()
                .findFirst()
                .orElse(null);

List<Integer> stringList = list.stream().map(AccountantCrew::getCrewEmpId).collect(Collectors.toList());