public static List<Purchase> removeDongxiangPurch(List<Purchase> listDongxiangPurchases){
ArrayList<Purchase> listDongxiangPurchase = listDongxiangPurchases.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(purchase -> purchase.getShopId() + purchase.getProductId()+ purchase.getFetchTime()))),
ArrayList::new
)
);
return listDongxiangPurchase;
}
去重。jdk1.8
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.