public void writeExternal(final ObjectOutput out) throws IOException
{
out.writeInt(this.bag.sizeDistinct());
try
{
this.bag.forEachWithOccurrences(new CheckedLongIntProcedure()
{
@Override
public void safeValue(long item, int count) throws IOException
{
out.writeLong(item);