public void writeObject(ObjectOutput output, Map map) throws IOException {
int number = numbers.get(map.getClass(), -1);
output.write(number);
switch (number) {
case EQUIVALENTHASHMAP:
EquivalentHashMap equivalentMap = (EquivalentHashMap) map;
output.writeObject(equivalentMap.getKeyEquivalence());
output.writeObject(equivalentMap.getValueEquivalence());
break;
case FASTCOPYHASHMAP:
//copy the map to avoid ConcurrentModificationException
MarshallUtil.marshallMap(((FastCopyHashMap<?, ?>) map).clone(), output);
return;