code: static <E> void populateMultiset(
        Multiset<E> multiset, ObjectInputStream stream, int distinctElements)
        throws IOException, ClassNotFoundException {
      for (int i = 0; i < distinctElements; i++) {
        @SuppressWarnings("unchecked") // reading data stored by writeMultiset
        E element = (E) stream.readObject();
        int count = stream.readInt();
        multiset.add(element, count);
      }
    }
docs: Populates a multiset by reading an input stream, as part of deserialization. See {@link
  #writeMultiset} for the data format. The number of distinct elements is determined by a prior
  call to {@link #readCount}.