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/06/19 20:59:46 UTC
svn commit: r1351800 -
/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java
Author: tn
Date: Tue Jun 19 18:59:46 2012
New Revision: 1351800
URL: http://svn.apache.org/viewvc?rev=1351800&view=rev
Log:
[COLLECTIONS-407] improve performance of remove method by taking method result from underlying collection into account. Thanks to Adrian Nistor for reporting and providing a patch.
Modified:
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java?rev=1351800&r1=1351799&r2=1351800&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java Tue Jun 19 18:59:46 2012
@@ -42,7 +42,7 @@ import org.apache.commons.collections.li
* the set can be obtained via <code>asList()</code>.
* <p>
* This class cannot implement the <code>List</code> interface directly as
- * various interface methods (notably equals/hashCode) are incompatable with a set.
+ * various interface methods (notably equals/hashCode) are incompatible with a set.
* <p>
* This class is Serializable from Commons Collections 3.1.
*
@@ -200,7 +200,9 @@ public class ListOrderedSet<E> extends A
@Override
public boolean remove(Object object) {
boolean result = collection.remove(object);
- setOrder.remove(object);
+ if (result) {
+ setOrder.remove(object);
+ }
return result;
}