changeset 16200:4d74b5d2086c

8170733: HashMap.HashIterator.remove method does not use cached value for the hash code. Reviewed-by: martin, dl, shade
author psandoz
date Mon, 05 Dec 2016 13:00:32 -0800
parents 5c9389804cbc
children 9f111abca7aa
files src/java.base/share/classes/java/util/HashMap.java src/java.base/share/classes/java/util/LinkedHashMap.java
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/HashMap.java	Mon Dec 05 12:53:53 2016 +0530
+++ b/src/java.base/share/classes/java/util/HashMap.java	Mon Dec 05 13:00:32 2016 -0800
@@ -1502,8 +1502,7 @@
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
             current = null;
-            K key = p.key;
-            removeNode(hash(key), key, null, false, false);
+            removeNode(p.hash, p.key, null, false, false);
             expectedModCount = modCount;
         }
     }
--- a/src/java.base/share/classes/java/util/LinkedHashMap.java	Mon Dec 05 12:53:53 2016 +0530
+++ b/src/java.base/share/classes/java/util/LinkedHashMap.java	Mon Dec 05 13:00:32 2016 -0800
@@ -731,8 +731,7 @@
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
             current = null;
-            K key = p.key;
-            removeNode(hash(key), key, null, false, false);
+            removeNode(p.hash, p.key, null, false, false);
             expectedModCount = modCount;
         }
     }