mirror of
https://github.com/apache/commons-collections.git
synced 2025-02-17 15:35:00 +00:00
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:
parent
b0649abda4
commit
ce4113cb92
@ -276,6 +276,12 @@ public class ListUtils {
|
|||||||
* in <code>collection</code> unless <code>retain</code> does not contain <code>e</code>, in which
|
* 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
|
* 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>.
|
* 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 <E> the element type
|
||||||
* @param collection the collection whose contents are the target of the #retailAll operation
|
* @param collection the collection whose contents are the target of the #retailAll operation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user