jdk8 按照属性中某一个字段去重
//day 为user的一个属性 List<User> setList = eachUser.stream() .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(User::getDay))), ArrayList::new));
//根据多个字段列去重 ars = ars.stream().collect(Collectors.collectingAndThen(Collectors.toCollection( () -> new TreeSet<AccountRole>(Comparator.comparing(o -> o.getAccountId() + ";" + o.getRoleId()))), ArrayList::new));