commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1069624 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java
Date Thu, 10 Feb 2011 23:58:00 GMT
Author: mbenson
Date: Thu Feb 10 23:57:59 2011
New Revision: 1069624

URL: http://svn.apache.org/viewvc?rev=1069624&view=rev
Log:
[COLLECTIONS-330] javadoc: add warning about calling get() while iterating

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java?rev=1069624&r1=1069623&r2=1069624&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java
Thu Feb 10 23:57:59 2011
@@ -23,6 +23,7 @@ import java.io.Serializable;
 import java.util.Map;
 
 import org.apache.commons.collections.BoundedMap;
+import org.apache.commons.collections.MapIterator;
 
 /**
  * A <code>Map</code> implementation with a fixed maximum size which removes
@@ -33,6 +34,13 @@ import org.apache.commons.collections.Bo
  * change the order. Queries such as containsKey and containsValue or access
  * via views also do not change the order.
  * <p>
+ * A somewhat subtle ramification of the least recently used
+ * algorithm is that calls to {@link #get(Object)} stand a very good chance
+ * of modifying the map's iteration order and thus invalidating any
+ * iterators currently in use.  It is therefore suggested that iterations
+ * over an {@link LRUMap} instance access entry values only through a
+ * {@link MapIterator} or {@link #entrySet()} iterator.
+ * <p>
  * The map implements <code>OrderedMap</code> and entries may be queried using
  * the bidirectional <code>OrderedMapIterator</code>. The order returned is
  * least recently used to most recently used. Iterators from map views can



Mime
View raw message