[jira] [Created] (COLLECTIONS-652) An obvious bug in CollectionUtils

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Created] (COLLECTIONS-652) An obvious bug in CollectionUtils

JIRA jira@apache.org
samray leung created COLLECTIONS-652:

             Summary: An obvious bug in CollectionUtils
                 Key: COLLECTIONS-652
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-652
             Project: Commons Collections
          Issue Type: Bug
          Components: Collection
    Affects Versions: 3.2.1
         Environment: windows 7, jdk8. This bug is so obvious so I think it is nothing to do with environment
            Reporter: samray leung
            Priority: Minor

In CollectionUtils.java:
Line number: 1121

     * Removes the elements in <code>remove</code> from <code>collection</code>. That is, this
     * method returns a collection containing all the elements in <code>c</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
     * the collection <code>c</code> and thus cannot call <code>collection.removeAll(remove);</code>.
     * @param collection  the collection from which items are removed (in the returned collection)
     * @param remove  the items to be removed from the returned <code>collection</code>
     * @return a <code>Collection</code> containing all the elements of <code>collection</code> except
     * any elements that also occur in <code>remove</code>.
     * @throws NullPointerException if either parameter is null
     * @since Commons Collections 3.2
    public static Collection removeAll(Collection collection, Collection remove) {
        return ListUtils.retainAll(collection, remove);
The method should call ListUtils.removeAll(Collection collection, Collection remove) instead of calling ListUtils.retailAll(collection,remove)

This message was sent by Atlassian JIRA