< prev index next >

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

Print this page

        

@@ -89,10 +89,11 @@
 
 public class HashSet<E>
     extends AbstractSet<E>
     implements Set<E>, Cloneable, java.io.Serializable
 {
+    @java.io.Serial
     static final long serialVersionUID = -5024744406713321676L;
 
     private transient HashMap<E,Object> map;
 
     // Dummy value to associate with an Object in the backing Map

@@ -269,10 +270,11 @@
      *             (int), and its load factor (float) are emitted, followed by
      *             the size of the set (the number of elements it contains)
      *             (int), followed by all of its elements (each an Object) in
      *             no particular order.
      */
+    @java.io.Serial
     private void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException {
         // Write out any hidden serialization magic
         s.defaultWriteObject();
 

@@ -290,10 +292,11 @@
 
     /**
      * Reconstitute the {@code HashSet} instance from a stream (that is,
      * deserialize it).
      */
+    @java.io.Serial
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
         // Read in any hidden serialization magic
         s.defaultReadObject();
 
< prev index next >