diff --git a/src/java/org/apache/commons/collections/map/LRUMap.java b/src/java/org/apache/commons/collections/map/LRUMap.java index 581266537..6e3fbf0bd 100644 --- a/src/java/org/apache/commons/collections/map/LRUMap.java +++ b/src/java/org/apache/commons/collections/map/LRUMap.java @@ -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 Map implementation with a fixed maximum size which removes @@ -33,6 +34,13 @@ import org.apache.commons.collections.BoundedMap; * change the order. Queries such as containsKey and containsValue or access * via views also do not change the order. *

+ * 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. + *

* The map implements OrderedMap and entries may be queried using * the bidirectional OrderedMapIterator. The order returned is * least recently used to most recently used. Iterators from map views can