commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1365784 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java
Date Wed, 25 Jul 2012 21:39:30 GMT
Author: tn
Date: Wed Jul 25 21:39:30 2012
New Revision: 1365784

URL: http://svn.apache.org/viewvc?rev=1365784&view=rev
Log:
Added clarifying javadoc for ListUtils#removeAll wrt runtime performance.

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=1365784&r1=1365783&r2=1365784&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
Wed Jul 25 21:39:30 2012
@@ -252,12 +252,18 @@ public class ListUtils {
 
     /**
      * Removes the elements in <code>remove</code> from <code>collection</code>.
That is, this
-     * method returns a list containing all the elements in <code>c</code>
+     * method returns a list containing all the elements in <code>collection</code>
      * that are not in <code>remove</code>. The cardinality of an element <code>e</code>
      * in the returned collection is the same as the cardinality of <code>e</code>
      * in <code>collection</code> unless <code>remove</code> contains
<code>e</code>, in which
      * case the cardinality is zero. This method is useful if you do not wish to modify
      * <code>collection</code> and thus cannot call <code>collection.removeAll(remove);</code>.
+     * <p> 
+     * This implementation iterates over <code>collection</code>, checking each
element in
+     * turn to see if it's contained in <code>remove</code>. If it's not contained,
it's added
+     * to the returned list. As a consequence, it is advised to use a collection type for
+     * <code>remove</code> that provides a fast (e.g. O(1)) implementation of
+     * {@link Collection#contains(Object)}.
      * 
      * @param <E>  the element type
      * @param collection  the collection from which items are removed (in the returned collection)



Mime
View raw message