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 2012/08/26 23:31:02 UTC

svn commit: r1377523 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java

Author: tn
Date: Sun Aug 26 21:31:02 2012
New Revision: 1377523

URL: http://svn.apache.org/viewvc?rev=1377523&view=rev
Log:
Added clarification on runtime complexity for ListUtils.retainAll.

Modified:
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java?rev=1377523&r1=1377522&r2=1377523&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java Sun Aug 26 21:31:02 2012
@@ -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