static < E > void writeMultiset ( Multiset < E > multiset , ObjectOutputStream stream ) throws IOException { int entryCount = multiset . entrySet ( ) . size ( ) ; stream . writeInt ( entryCount ) ; for ( Multiset . Entry < E > entry : multiset . entrySet ( ) ) { stream . writeObject ( entry . getElement ( ) ) ; stream . writeInt ( entry . getCount ( ) ) ; } }
Stores the contents of a multiset in an output stream as part of serialization . It does not support concurrent multisets whose content may change while the method is running .