7175464: entrySetView field is never updated in NavigableSubMap

The method entrySet() in AscendingSubMap and DescendingSubMap failed to cache the entrySetView.

Reviewed-by: alanb, psandoz
This commit is contained in:
Mike Duigou 2012-11-29 14:07:47 -08:00
parent 79727a83aa
commit 1cf41521cc

View File

@ -1759,7 +1759,7 @@ public class TreeMap<K,V>
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 class TreeMap<K,V>
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(); }