[COLLECTIONS-445] Clarify that the behavior of IBM JDK is not really a bug, Map.Entry specifies that its behavior is undefined if the backing map is modified.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1454717 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-03-09 14:24:34 +00:00
parent 83371b380d
commit 2bafac38a7
1 changed files with 3 additions and 2 deletions

View File

@ -363,8 +363,9 @@ public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V>
"Cannot use setValue() when the object being set is already in the map");
}
final V oldValue = parent.put(last.getKey(), value);
// set also the value in the Map.Entry:
// due to a bug in IBM JDK where the Entry is not in sync with the underlying map
// Map.Entry specifies that the behavior is undefined when the backing map
// has been modified (as we did with the put), so we also set the value
// (especially needed for IBM JDK)
last.setValue(value);
return oldValue;
}