@SuppressWarnings("nullness") @GwtIncompatible("java.io.ObjectOutputStream") public static <K extends Object,V extends Object>void writeMap(Map<K,V> map,ObjectOutputStream stream) throws IOException {
  stream.writeInt(map.size());
  for (  Map.Entry<K,V> entry : map.entrySet()) {
    stream.writeObject(entry.getKey());
    stream.writeObject(entry.getValue());
  }
}

@ SuppressWarnings ( "nullness" ) @ GwtIncompatible ( "java.io.ObjectOutputStream" ) public static < K extends Object , V extends Object > void writeMap ( Map < K , V > map , ObjectOutputStream stream ) throws IOException { stream . writeInt ( map . size ( ) ) ; for ( Map . Entry < K , V > entry : map . entrySet ( ) ) { stream . writeObject ( entry . getKey ( ) ) ; stream . writeObject ( entry . getValue ( ) ) ; } }
stores the contents of a map in an output stream , as part of serialization . it does not support concurrent maps whose content may change while the method is running . < p > the serialized output consists of the number of entries , first key , first value , second key , second value , and so on .
