list中的对象某个属性存在重复时将重复的对象去重

//根据skuAttrValueName值去重
            List<SkuValue> uniqueSkuValues = skuValues.stream().collect(
                    Collectors.collectingAndThen(Collectors.toCollection(
                            () -> new TreeSet<>(Comparator.comparing(o -> o.getSkuAttrValueName()))), ArrayList::new)
            );

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2021-05-23
相关资源
相似解决方案