Stream流根据指定字段去重

List alarmList = outSideInterfaceService.queryDeviceList(form);
alarmList = alarmList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DeviceInfoVo::getDeviceId))), ArrayList::new));

你可能感兴趣的:(java)