Edit January 1, 2014 Apache Commons Collections 4.0 was finally released on November 21, 2013, and contains a fix for this issue.
Link to CollectionUtils.java
Lines in question (1688 – 1691), with acknowledgement the method was previously broken:
/*
...
* @since 4.0 (method existed in 3.2 but was completely broken)
*/
public static <E> Collection<E> removeAll(final Collection<E> collection, final Collection<?> remove) {
return ListUtils.removeAll(collection, remove);
}
Original Answer
Nope, you’re not crazy. removeAll() is actually (incorrectly) calling retainAll().
This is a bug in CollectionUtils, affecting version 3.2. It’s been fixed, but only in the 4.0 branch.
https://issues.apache.org/jira/browse/COLLECTIONS-349
And as further proof, here’s a link to the source code:
http://svn.apache.org/repos/asf/commons/proper/collections/tags/COLLECTIONS_3_2/src/java/org/apache/commons/collections/CollectionUtils.java
Check out this line:
public static Collection removeAll(Collection collection, Collection remove) {
return ListUtils.retainAll(collection, remove);
}
Yep…broken!