< prev index next >

src/java.base/share/classes/java/util/TreeMap.java

Print this page

        

@@ -1337,10 +1337,11 @@
     /**
      * @serial include
      */
     abstract static class NavigableSubMap<K,V> extends AbstractMap<K,V>
         implements NavigableMap<K,V>, java.io.Serializable {
+        @java.io.Serial
         private static final long serialVersionUID = -2102997345730753016L;
         /**
          * The backing map.
          */
         final TreeMap<K,V> m;

@@ -1842,10 +1843,11 @@
 
     /**
      * @serial include
      */
     static final class AscendingSubMap<K,V> extends NavigableSubMap<K,V> {
+        @java.io.Serial
         private static final long serialVersionUID = 912986545866124060L;
 
         AscendingSubMap(TreeMap<K,V> m,
                         boolean fromStart, K lo, boolean loInclusive,
                         boolean toEnd,     K hi, boolean hiInclusive) {

@@ -1925,10 +1927,11 @@
 
     /**
      * @serial include
      */
     static final class DescendingSubMap<K,V>  extends NavigableSubMap<K,V> {
+        @java.io.Serial
         private static final long serialVersionUID = 912986545866120460L;
         DescendingSubMap(TreeMap<K,V> m,
                         boolean fromStart, K lo, boolean loInclusive,
                         boolean toEnd,     K hi, boolean hiInclusive) {
             super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);

@@ -2017,13 +2020,15 @@
      *
      * @serial include
      */
     private class SubMap extends AbstractMap<K,V>
         implements SortedMap<K,V>, java.io.Serializable {
+        @java.io.Serial
         private static final long serialVersionUID = -6520786458950516097L;
         private boolean fromStart = false, toEnd = false;
         private K fromKey, toKey;
+        @java.io.Serial
         private Object readResolve() {
             return new AscendingSubMap<>(TreeMap.this,
                                          fromStart, fromKey, true,
                                          toEnd, toKey, false);
         }

@@ -2404,10 +2409,11 @@
         }
 
         setColor(x, BLACK);
     }
 
+   @java.io.Serial
     private static final long serialVersionUID = 919286545866124006L;
 
     /**
      * Save the state of the {@code TreeMap} instance to a stream (i.e.,
      * serialize it).

@@ -2418,10 +2424,11 @@
      *             by the TreeMap. The key-value mappings are emitted in
      *             key-order (as determined by the TreeMap's Comparator,
      *             or by the keys' natural ordering if the TreeMap has no
      *             Comparator).
      */
+    @java.io.Serial
     private void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException {
         // Write out the Comparator and any hidden stuff
         s.defaultWriteObject();
 

@@ -2437,10 +2444,11 @@
 
     /**
      * Reconstitute the {@code TreeMap} instance from a stream (i.e.,
      * deserialize it).
      */
+    @java.io.Serial
     private void readObject(final java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
         // Read in the Comparator and any hidden stuff
         s.defaultReadObject();
 
< prev index next >