//根据元素去重list记录,JKD1.8新特性Collectors
List<GysfkAlertBlxw> list2 = list.stream().collect(Collectors.collectingAndThen
(Collectors.toCollection(() -> new
TreeSet<>(Comparator.comparing(GysfkAlertBlxw :: getSupplierCode))), ArrayList::new));
for (GysfkAlertBlxw gysfkAlertBlxw : list2) {
System.out.println(gysfkAlertBlxw.getSupplierCode());
}
================================================================================
GysfkAlertBlxw p1 = new GysfkAlertBlxw();
GysfkAlertBlxw p2 = new GysfkAlertBlxw();
p1.setSupplierCode("wyf");
p2.setSupplierCode("abc");
//判断,该list对象集合里是否有某个 元素值
boolean bool = list3.stream().anyMatch(a -> a.getSupplierCode().equals("wyf"));
System.out.println(bool);
//获取list下对应的元素
List<GysfkAlertBlxw> data = list3.stream().filter(a -> a.getSupplierCode().equals("wyf"))
.collect(Collectors.toList());