java8 过滤两个list集合中相同的元素 并返回相同list集合

List result = studentForPayResultList.stream().filter(
                (studentForPayResult) ->payList.stream().map(BaseActivePay::getStudentId).collect(Collectors.toList()).contains(studentForPayResult.getStudentId())
        ).collect(Collectors.toList());

你可能感兴趣的:(JAVA8,java,stream,filter)