code: private void writeObject(java.io.ObjectOutputStream s)
          throws java.io.IOException
      {
          // Write out the key type and any hidden stuff
          s.defaultWriteObject();
  
          // Write out size (number of Mappings)
          s.writeInt(size);
  
          // Write out keys and values (alternating)
          int entriesToBeWritten = size;
          for (int i = 0; entriesToBeWritten > 0; i++) {
              if (null != vals[i]) {
                  s.writeObject(keyUniverse[i]);
                  s.writeObject(unmaskNull(vals[i]));
                  entriesToBeWritten--;
              }
          }
      }
docs: Save the state of the <tt>EnumMap</tt> instance to a stream (i.e.,
  serialize it).
  
  @serialData The <i>size</i> of the enum map (the number of key-value
  mappings) is emitted (int), followed by the key (Object)
  and value (Object) for each key-value mapping represented
  by the enum map.