List<PatientBlackVO> collect = new ArrayList<>();
list2.stream().filter(Objects::nonNull).forEach(s -> {
List<PatientBlackVO> collect1 = blackRecordList.stream().filter(s1 -> Objects.nonNull(s1) && !s.getPatientId().equals(s1.getPatientId())).map(s1 -> {
Long patientId = s.getPatientId();
Long jobId = s.getJobId();
Integer templateType = s1.getTemplateType();
PatientBlackVO patientBlackVO = new PatientBlackVO();
patientBlackVO.setPatientId(patientId);
patientBlackVO.setTemplateType(templateType);
patientBlackVO.setJobId(jobId);
return patientBlackVO;
}).collect(toList());
collect.addAll(collect1);
});
java8两个list 根据相同的字段取不同值返回新的list
最新推荐文章于 2024-03-15 21:06:43 发布