Added clarification on runtime complexity for ListUtils.retainAll.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1377523 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2012-08-26 21:31:02 +00:00
parent b0649abda4
commit ce4113cb92
1 changed files with 6 additions and 0 deletions

View File

@ -276,6 +276,12 @@ public class ListUtils {
* 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>collection.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 <E> the element type
* @param collection the collection whose contents are the target of the #retailAll operation