list根据对象属性去重

ArrayList < PayRecord > importListSingle = importList.stream().collect(collectingAndThen(toCollection(
() -> new TreeSet <>(Comparator.comparing(PayRecord :: getPrIdentityNumber)
.thenComparing(PayRecord :: getPrPayType))) , ArrayList :: new));

  

posted @ 2021-09-27 18:39  小尼  阅读(95)  评论(0编辑  收藏  举报