利用java8对数组按对象属性去重
ArrayList<DeptEntity> disList = newList.stream().collect(
Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DeptEntity::getId))), ArrayList::new));
ArrayList<DeptEntity> disList = newList.stream().collect(
Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DeptEntity::getId))), ArrayList::new));