用流根据list里面的对象的条件过滤出相同的数据

List<EmpSupportDto> collect = infoList.stream()
        .filter(e1 -> infoList.stream()
                .anyMatch(e2 -> e2 != e1 && e2.getEmpId().equals(e1.getEmpId())))
        .collect(Collectors.toList());

猜你喜欢

转载自blog.csdn.net/m0_64979027/article/details/131007253