java利用stream流查出符合某个条件的list,并且进行赋值

ListworkHandoverList2=workHandoverList.stream().filter(item->item.getIsDelete().equals(0)).collect(Collectors.toList());//获取list中符合没有删除的工作交接的list

ListworkHandoverList1=workHandoverList.stream().filter(item->item.getIsDelete().equals(1)).collect(Collectors.toList());

workHandoverList1.stream().forEach(item->item.setDispathStatus(null));//对查询出来的list统一赋值

workHandoverList1.stream().forEach(item->item.setShowDispathStatus(null));

//workHandoverList1.stream().forEach(item->item.setDispathId(null));

workHandoverList2.addAll(workHandoverList1);

 

你可能感兴趣的:(ζ编程语言,——java)