jdk/src/share/classes/java/util/TreeMap.java
changeset 23746 ce60f7b62312
parent 23050 24d28d1eb7a9
equal deleted inserted replaced
23745:7898c52fcfb4 23746:ce60f7b62312
   118      *
   118      *
   119      * @serial
   119      * @serial
   120      */
   120      */
   121     private final Comparator<? super K> comparator;
   121     private final Comparator<? super K> comparator;
   122 
   122 
   123     private transient Entry<K,V> root = null;
   123     private transient Entry<K,V> root;
   124 
   124 
   125     /**
   125     /**
   126      * The number of entries in the tree
   126      * The number of entries in the tree
   127      */
   127      */
   128     private transient int size = 0;
   128     private transient int size = 0;
   779     /**
   779     /**
   780      * Fields initialized to contain an instance of the entry set view
   780      * Fields initialized to contain an instance of the entry set view
   781      * the first time this view is requested.  Views are stateless, so
   781      * the first time this view is requested.  Views are stateless, so
   782      * there's no reason to create more than one.
   782      * there's no reason to create more than one.
   783      */
   783      */
   784     private transient EntrySet entrySet = null;
   784     private transient EntrySet entrySet;
   785     private transient KeySet<K> navigableKeySet = null;
   785     private transient KeySet<K> navigableKeySet;
   786     private transient NavigableMap<K,V> descendingMap = null;
   786     private transient NavigableMap<K,V> descendingMap;
   787 
   787 
   788     /**
   788     /**
   789      * Returns a {@link Set} view of the keys contained in this map.
   789      * Returns a {@link Set} view of the keys contained in this map.
   790      *
   790      *
   791      * <p>The set's iterator returns the keys in ascending order.
   791      * <p>The set's iterator returns the keys in ascending order.
  1581                 m.deleteEntry(e);
  1581                 m.deleteEntry(e);
  1582             return result;
  1582             return result;
  1583         }
  1583         }
  1584 
  1584 
  1585         // Views
  1585         // Views
  1586         transient NavigableMap<K,V> descendingMapView = null;
  1586         transient NavigableMap<K,V> descendingMapView;
  1587         transient EntrySetView entrySetView = null;
  1587         transient EntrySetView entrySetView;
  1588         transient KeySet<K> navigableKeySetView = null;
  1588         transient KeySet<K> navigableKeySetView;
  1589 
  1589 
  1590         public final NavigableSet<K> navigableKeySet() {
  1590         public final NavigableSet<K> navigableKeySet() {
  1591             KeySet<K> nksv = navigableKeySetView;
  1591             KeySet<K> nksv = navigableKeySetView;
  1592             return (nksv != null) ? nksv :
  1592             return (nksv != null) ? nksv :
  1593                 (navigableKeySetView = new TreeMap.KeySet<>(this));
  1593                 (navigableKeySetView = new TreeMap.KeySet<>(this));
  2044      */
  2044      */
  2045 
  2045 
  2046     static final class Entry<K,V> implements Map.Entry<K,V> {
  2046     static final class Entry<K,V> implements Map.Entry<K,V> {
  2047         K key;
  2047         K key;
  2048         V value;
  2048         V value;
  2049         Entry<K,V> left = null;
  2049         Entry<K,V> left;
  2050         Entry<K,V> right = null;
  2050         Entry<K,V> right;
  2051         Entry<K,V> parent;
  2051         Entry<K,V> parent;
  2052         boolean color = BLACK;
  2052         boolean color = BLACK;
  2053 
  2053 
  2054         /**
  2054         /**
  2055          * Make a new cell with given key, value, and parent, and with
  2055          * Make a new cell with given key, value, and parent, and with