记录一个不常见但使用的stream用法
List<EnforcementImportDto> enforcementList 是一个不为空的列表
EnforcementImportDto有 bidId的字段
所以可以实现根据bidId字段,去重列表enforcementList
除了去重字段,其他是固定写法
enforcementList = enforcementList.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(
Comparator.comparing(EnforcementImportDto::getBidId))
), ArrayList::new)
);