diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 72de0da81..26ca62fcb 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -22,6 +22,10 @@
* This operation changes the position of the key in the map to the - * most recently used position (first). + * most recently used position (last). * * @param key the key * @return the mapped value, null if no match */ @Override public V get(final Object key) { + return get(key, true); + } + + /** + * Gets the value mapped to the key specified. + *
+ * If {@code updateToMRU} is {@code true}, the position of the key in the map
+ * is changed to the most recently used position (last), otherwise the iteration
+ * order is not changed by this operation.
+ *
+ * @param key the key
+ * @param updateToMRU whether the key shall be updated to the
+ * most recently used position
+ * @return the mapped value, null if no match
+ */
+ public V get(final Object key, final boolean updateToMRU) {
final LinkEntry
- * This implementation moves the updated entry to the top of the list
+ * This implementation moves the updated entry to the end of the list
* using {@link #moveToMRU(AbstractLinkedMap.LinkEntry)}.
*
* @param entry the entry to update
diff --git a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
index 9c0d7d6c6..f47741e3d 100644
--- a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
@@ -224,6 +224,55 @@ public class LRUMapTest