Author: tn
Date: Mon Jan 12 14:06:07 2015
New Revision: 1651098
URL: http://svn.apache.org/r1651098
Log:
[COLLECTIONS-544] Documented runtime complexity of
CollectionUtils.retainAll(Collection, Collection). Thanks to Oswaldo Olivo.
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=1651098&r1=1651097&r2=1651098&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/changes/changes.xml (original)
+++ commons/proper/collections/trunk/src/changes/changes.xml Mon Jan 12
14:06:07 2015
@@ -22,6 +22,9 @@
<body>
<release version="4.1" date="TBD" description="">
+ <action issue="COLLECTIONS-544" dev="tn" type="fix" due-to="Oswaldo Olivo">
+ Documented runtime complexity of "CollectionUtils#retainAll(Collection,
Collection).
+ </action>
<action issue="COLLECTIONS-542" dev="tn" type="fix">
"AbstractHashedMap" still inherits from "AbstractMap", contrary to what
the class javadoc stated. The inheritance will now be removed in v5.0.
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=1651098&r1=1651097&r2=1651098&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
Mon Jan 12 14:06:07 2015
@@ -1883,6 +1883,12 @@ public class CollectionUtils {
* in <code>collection</code> unless <code>retain</code> does not contain
<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>c.retainAll(retain);</code>.
+ * <p>
+ * This implementation iterates over <code>collection</code>, checking
each element in
+ * turn to see if it's contained in <code>retain</code>. If it's
contained, it's added
+ * to the returned list. As a consequence, it is advised to use a
collection type for
+ * <code>retain</code> that provides a fast (e.g. O(1)) implementation of
+ * {@link Collection#contains(Object)}.
*
* @param <C> the type of object the {@link Collection} contains
* @param collection the collection whose contents are the target of the
#retailAll operation