8170733: HashMap.HashIterator.remove method does not use cached value for the hash code.
Reviewed-by: martin, dl, shade
--- a/jdk/src/java.base/share/classes/java/util/HashMap.java Mon Dec 05 12:53:53 2016 +0530
+++ b/jdk/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/jdk/src/java.base/share/classes/java/util/LinkedHashMap.java Mon Dec 05 12:53:53 2016 +0530
+++ b/jdk/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;
}
}