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
diff --git a/src/share/classes/java/util/TreeMap.java b/src/share/classes/java/util/TreeMap.java
index 59a0eaa..14d75e7 100644
--- a/src/share/classes/java/util/TreeMap.java
+++ b/src/share/classes/java/util/TreeMap.java
@@ -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(); }