I found this source code from java 1.7.0_11
public boolean removeAll(Collection<?> c) {
boolean modified = false;
for (Iterator<K> i = iterator(); i.hasNext(); ) {
if (c.contains(i.next())) {
i.remove();
modified = true;
}
}
return modified;
}
It is using c.contains() so the behaviour depends on the collection class. I didn't understand that from the javadoc.
I found out it is a bug reported 6 years ago and still unresolved!! http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6588783