ArrayList 除重

看到一段简洁的 ArrayList 除重代码:

protected final <T> List<T> removeDuplicates(List<T> list) {
        return new ArrayList<T>(new LinkedHashSet<T>(list));
}

 

List  转 array:

String[] candidates = configurations.toArray(newString[configurations.size()]);

 

posted @ 2018-09-19 22:11  xiluhua  阅读(177)  评论(0编辑  收藏  举报