[COLLECTIONS-544] Documented runtime complexity of CollectionUtils.retainAll(Collection, Collection). Thanks to Oswaldo Olivo.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1651098 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2015-01-12 14:06:07 +00:00
parent f59e419683
commit 9e64a3cb81
2 changed files with 9 additions and 0 deletions

View File

@ -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.

View File

@ -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