`

转载 解决collection调用removeAll()移除不了不同引用同值对象的问题

 
阅读更多

解决collection调用removeAll()移除不了不同引用同值对象的问题

 

http://blog.csdn.net/tavor/article/details/2502350

 

 

关于java中List的removeAll()方法删除大量数据时的效率问题

 

http://www.iteye.com/problems/80120

 

public static List removeAll(List a,List b){

LinkedList c=new LinkedList(a);//大集合用LinkedList 

HashSet s=new HashSet(b);//小集合用HashSet 

Iterator iter=c.iter;

while(iter.hasNext()){

if(s.contains(iter.next()){

iter.remove();

}

}

return c;

}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics