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. The serialized output consists of the number of distinct elements, the first element, its count, the second element, its
(Multiset<E> multiset, ObjectOutputStream stream)
| 105 | */ |
| 106 | |
| 107 | static <E> void writeMultiset(Multiset<E> multiset, ObjectOutputStream stream) throws IOException { |
| 108 | int entryCount = multiset.entrySet().size(); |
| 109 | stream.writeInt(entryCount); |
| 110 | for (Multiset.Entry<E> entry : multiset.entrySet()) { |
| 111 | stream.writeObject(entry.getElement()); |
| 112 | stream.writeInt(entry.getCount()); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Populates a multiset by reading an input stream, as part of |
no test coverage detected