lambda表达式

两List类型类似mysql左连接操作

    /**
     * 类似mysql左连接
     * @param oneList
     * @param twoList
     * @return
     */
    public static List compareTwo(List oneList, List twoList) {
        List list = oneList.stream().map(
                person -> twoList.stream().filter(identity -> person.getEmployee().equals(identity.getNumber()))
                        .findFirst().map(i -> {
                            person.setLoginNumber(i.getLoginName());
                            return person;
                        }).orElse(person)
        ).collect(Collectors.toList());
        return list;
    }

你可能感兴趣的:(lambda表达式)