src/java.base/share/classes/java/util/TreeMap.java
changeset 58520 e036ee8bae56
parent 57956 e0b8b019d2f5
child 58679 9c3209ff7550
equal deleted inserted replaced
58519:6e017b301287 58520:e036ee8bae56
   116      * The comparator used to maintain order in this tree map, or
   116      * The comparator used to maintain order in this tree map, or
   117      * null if it uses the natural ordering of its keys.
   117      * null if it uses the natural ordering of its keys.
   118      *
   118      *
   119      * @serial
   119      * @serial
   120      */
   120      */
       
   121     @SuppressWarnings("serial") // Conditionally serializable
   121     private final Comparator<? super K> comparator;
   122     private final Comparator<? super K> comparator;
   122 
   123 
   123     private transient Entry<K,V> root;
   124     private transient Entry<K,V> root;
   124 
   125 
   125     /**
   126     /**
  1351          * true, then the low (absolute) bound is the start of the
  1352          * true, then the low (absolute) bound is the start of the
  1352          * backing map, and the other values are ignored. Otherwise,
  1353          * backing map, and the other values are ignored. Otherwise,
  1353          * if loInclusive is true, lo is the inclusive bound, else lo
  1354          * if loInclusive is true, lo is the inclusive bound, else lo
  1354          * is the exclusive bound. Similarly for the upper bound.
  1355          * is the exclusive bound. Similarly for the upper bound.
  1355          */
  1356          */
  1356         final K lo, hi;
  1357         @SuppressWarnings("serial") // Conditionally serializable
       
  1358         final K lo;
       
  1359         @SuppressWarnings("serial") // Conditionally serializable
       
  1360         final K hi;
  1357         final boolean fromStart, toEnd;
  1361         final boolean fromStart, toEnd;
  1358         final boolean loInclusive, hiInclusive;
  1362         final boolean loInclusive, hiInclusive;
  1359 
  1363 
  1360         NavigableSubMap(TreeMap<K,V> m,
  1364         NavigableSubMap(TreeMap<K,V> m,
  1361                         boolean fromStart, K lo, boolean loInclusive,
  1365                         boolean fromStart, K lo, boolean loInclusive,
  1934                         boolean fromStart, K lo, boolean loInclusive,
  1938                         boolean fromStart, K lo, boolean loInclusive,
  1935                         boolean toEnd,     K hi, boolean hiInclusive) {
  1939                         boolean toEnd,     K hi, boolean hiInclusive) {
  1936             super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
  1940             super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
  1937         }
  1941         }
  1938 
  1942 
       
  1943         @SuppressWarnings("serial") // Conditionally serializable
  1939         private final Comparator<? super K> reverseComparator =
  1944         private final Comparator<? super K> reverseComparator =
  1940             Collections.reverseOrder(m.comparator);
  1945             Collections.reverseOrder(m.comparator);
  1941 
  1946 
  1942         public Comparator<? super K> comparator() {
  1947         public Comparator<? super K> comparator() {
  1943             return reverseComparator;
  1948             return reverseComparator;
  2022     private class SubMap extends AbstractMap<K,V>
  2027     private class SubMap extends AbstractMap<K,V>
  2023         implements SortedMap<K,V>, java.io.Serializable {
  2028         implements SortedMap<K,V>, java.io.Serializable {
  2024         @java.io.Serial
  2029         @java.io.Serial
  2025         private static final long serialVersionUID = -6520786458950516097L;
  2030         private static final long serialVersionUID = -6520786458950516097L;
  2026         private boolean fromStart = false, toEnd = false;
  2031         private boolean fromStart = false, toEnd = false;
  2027         private K fromKey, toKey;
  2032         @SuppressWarnings("serial") // Conditionally serializable
       
  2033         private K fromKey;
       
  2034         @SuppressWarnings("serial") // Conditionally serializable
       
  2035         private K toKey;
  2028         @java.io.Serial
  2036         @java.io.Serial
  2029         private Object readResolve() {
  2037         private Object readResolve() {
  2030             return new AscendingSubMap<>(TreeMap.this,
  2038             return new AscendingSubMap<>(TreeMap.this,
  2031                                          fromStart, fromKey, true,
  2039                                          fromStart, fromKey, true,
  2032                                          toEnd, toKey, false);
  2040                                          toEnd, toKey, false);