底层是用迭代器来实现的
public boolean removeAll(Collection collection) {
boolean result = false;
Iterator it = iterator();
while (it.hasNext()) {
if (collection.contains(it.next())) {
it.remove();
result = true;
}
}
return result;
}
底层操作我并不清楚 但是用contains 和remove可以完成这个操作啊