code: private void writeObject(java.io.ObjectOutputStream s)
          throws java.io.IOException {
          s.defaultWriteObject();
          for (E e : this)
              s.writeObject(e);
          // Use trailing null as sentinel
          s.writeObject(null);
      }
docs: Saves the state to a stream (that is, serializes it).
  
  @serialData All of the elements (each an {@code E}) in
  the proper order, followed by a null
  @param s the stream