Collection 的子类 都有 参数 为 collection的构造方法。
例如:
public TreeSet(Collection<? extends E> c) {
this();
addAll(c);
}
所以 通过 创建 Tree对象 去除 重复元素
//list去重复元素
private ArrayList listRemoveRepeat(List list) {
//去重 并且按照自然顺序排列
TreeSet treeSet = new TreeSet(list);
ArrayList newList = new ArrayList(treeSet);
return newList;
}