You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/01/23 10:34:19 UTC

svn commit: r1654156 - in /commons/proper/collections/trunk/src: changes/changes.xml main/java/org/apache/commons/collections4/CollectionUtils.java

Author: tn
Date: Fri Jan 23 09:34:18 2015
New Revision: 1654156

URL: http://svn.apache.org/r1654156
Log:
[COLLECTIONS-545] Documented runtime complexity of CollectionUtils#removeAll(Collection, Collection).

Modified:
    commons/proper/collections/trunk/src/changes/changes.xml
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java

Modified: commons/proper/collections/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/changes/changes.xml?rev=1654156&r1=1654155&r2=1654156&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/changes/changes.xml (original)
+++ commons/proper/collections/trunk/src/changes/changes.xml Fri Jan 23 09:34:18 2015
@@ -22,6 +22,9 @@
   <body>
 
   <release version="4.1" date="TBD" description="">
+    <action issue="COLLECTIONS-545" dev="tn" type="fix" due-to="Oswaldo Olivo">
+      Documented runtime complexity of "CollectionUtils#removeAll(Collection, Collection).
+    </action>
     <action issue="COLLECTIONS-543" dev="tn" type="fix">
       "AbstractCollectionDecorator" doesn't forward equals and hashCode anymore.
     </action>

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java?rev=1654156&r1=1654155&r2=1654156&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java Fri Jan 23 09:34:18 2015
@@ -1957,6 +1957,12 @@ public class CollectionUtils {
      * in <code>collection</code> unless <code>remove</code> contains <code>e</code>, in which
      * case the cardinality is zero. This method is useful if you do not wish to modify
      * the collection <code>c</code> and thus cannot call <code>collection.removeAll(remove);</code>.
+     * <p>
+     * This implementation iterates over <code>collection</code>, checking each element in
+     * turn to see if it's contained in <code>remove</code>. If it's not contained, it's added
+     * to the returned list. As a consequence, it is advised to use a collection type for
+     * <code>remove</code> that provides a fast (e.g. O(1)) implementation of
+     * {@link Collection#contains(Object)}.
      *
      * @param <E>  the type of object the {@link Collection} contains
      * @param collection  the collection from which items are removed (in the returned collection)