---
title: "转载 解决collection调用removeAll()移除不了不同引用同值对象的问题"
author: "corelengine"
date: "2014-07-28T16:41:10Z"
tags: []
categories: ["编程语言"]
slug: "collection-removeall"
draft: false
lastmod: "2014-07-28T16:41:10Z"
id: 2097386
url: "https://corelengine.iteye.com/blog/2097386"
---

# [解决collection调用removeAll()移除不了不同引用同值对象的问题](http://blog.csdn.net/tavor/article/details/2502350)

 

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

 

 

### [关于java中List的removeAll()方法删除大量数据时的效率问题](http://www.iteye.com/problems/80120)

 

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;

}