Author: tn
Date: Sun Oct 19 12:44:34 2014
New Revision: 1632904

URL: http://svn.apache.org/r1632904
Log:
[COLLECTIONS-534] Added clarifiying comment about performance to 
CollectionBag.retainAll. Thanks to Oswaldo Olivo.

Modified:
    commons/proper/collections/trunk/src/changes/changes.xml
    
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.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=1632904&r1=1632903&r2=1632904&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/changes/changes.xml (original)
+++ commons/proper/collections/trunk/src/changes/changes.xml Sun Oct 19 
12:44:34 2014
@@ -22,8 +22,11 @@
   <body>
 
   <release version="4.1" date="TBD" description="">
+    <action issue="COLLECTIONS-534" dev="tn" type="fix" due-to="Oswaldo Olivo">
+      Added clarifying javadoc wrt runtime complexity of 
"CollectionBag#retainAll".
+    </action>
     <action issue="COLLECTIONS-535" dev="britter" type="update" 
due-to="Alexander Kjäll">
-      Clarify JavaDoc of MultiKey getKey() and size()
+      Clarify JavaDoc of MultiKey getKey() and size().
     </action>
     <action issue="COLLECTIONS-529" dev="tn" type="add" due-to="Alexander 
Muthmann, Dipanjan Laha">
       Added methods "removeAll(...)" and "retainAll(...)" to "CollectionUtils" 
that perform

Modified: 
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java
URL: 
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java?rev=1632904&r1=1632903&r2=1632904&view=diff
==============================================================================
--- 
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java
 (original)
+++ 
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java
 Sun Oct 19 12:44:34 2014
@@ -186,11 +186,17 @@ public final class CollectionBag<E> exte
 
     /**
      * <i>(Change)</i>
-     * Remove any members of the bag that are not in the given
-     * collection, <i>not</i> respecting cardinality. That is, any object
-     * in the given collection <code>coll</code> will be retained in the
-     * bag with the same number of copies prior to this operation. All
-     * other objects will be completely removed from this bag.
+     * Remove any members of the bag that are not in the given collection,
+     * <i>not</i> respecting cardinality. That is, any object in the given
+     * collection <code>coll</code> will be retained in the bag with the same
+     * number of copies prior to this operation. All other objects will be
+     * completely removed from this bag.
+     * <p>
+     * This implementation iterates over the elements of this bag, checking
+     * each element in turn to see if it's contained in <code>coll</code>.
+     * If it's not contained, it's removed from this bag. As a consequence,
+     * it is advised to use a collection type for <code>coll</code> that 
provides
+     * a fast (e.g. O(1)) implementation of {@link 
Collection#contains(Object)}.
      *
      * @param coll  the collection to retain
      * @return <code>true</code> if this call changed the collection


Reply via email to