7175464: entrySetView field is never updated in NavigableSubMap
Summary: The method entrySet() in AscendingSubMap and DescendingSubMap failed to cache the entrySetView.
Reviewed-by: alanb, psandoz
--- a/jdk/src/share/classes/java/util/TreeMap.java Thu Nov 29 17:03:52 2012 +0000
+++ b/jdk/src/share/classes/java/util/TreeMap.java Thu Nov 29 14:07:47 2012 -0800
@@ -1759,7 +1759,7 @@
public Set<Map.Entry<K,V>> entrySet() {
EntrySetView es = entrySetView;
- return (es != null) ? es : new AscendingEntrySetView();
+ return (es != null) ? es : (entrySetView = new AscendingEntrySetView());
}
TreeMap.Entry<K,V> subLowest() { return absLowest(); }
@@ -1840,7 +1840,7 @@
public Set<Map.Entry<K,V>> entrySet() {
EntrySetView es = entrySetView;
- return (es != null) ? es : new DescendingEntrySetView();
+ return (es != null) ? es : (entrySetView = new DescendingEntrySetView());
}
TreeMap.Entry<K,V> subLowest() { return absHighest(); }