[COLLECTION-425] Improved performance of ListOrderedMap#remove method, thanks to Adrian Nistor for report and patch.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1365749 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ff79ffc826
commit
ab7f253ce5
|
@ -22,7 +22,9 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<release version="4.0" date="TBA" description="Next release">
|
<release version="4.0" date="TBA" description="Next release">
|
||||||
<action issue="COLLECTIONS-XXX" type="fix">Dummy</action>
|
<action issue="COLLECTIONS-425" type="fix" due-to="Adrian Nistor">
|
||||||
|
Improved performance of ListOrderedMap#remove(Object) method.
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
</body>
|
</body>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -251,8 +251,11 @@ public class ListOrderedMap<K, V>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V remove(Object key) {
|
public V remove(Object key) {
|
||||||
V result = decorated().remove(key);
|
V result = null;
|
||||||
insertOrder.remove(key);
|
if (decorated().containsKey(key)) {
|
||||||
|
result = decorated().remove(key);
|
||||||
|
insertOrder.remove(key);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue