用HashSet
Iterator it =list.iterator();
HashSet set = new HashSet();
while(it.hasNext()){
set.add(it.next());
}
it = set.iterator();
HashSet set = new HashSet();
while(it.hasNext()){
set.add(it.next());
}
it = set.iterator();
list.clear();
while(it.hasNext()){
list.add(it.next());
}
或者是
while(it.hasNext()){
list.add(it.next());
}
或者是
list = new ArrayList(new HashSet(oldList));
1 条评论:
假的,不能用。
后来者别上当!!!
发表评论