Re: Efficient hashmap serialization?




I told a slight lie, it's a HashTable

private Hashtable<Double, Message> Messages = new Hashtable<Double,
Message>();

The Message object has a load of elements,

private double postNumber = 0;
private LinkTag postName;
private ImageTag postIcon;
private Text subject = null;
private List<AbstractNode> text = null;
private List<Tag> postAppeal = null;
private Identity poster = null;
private Date date = null;
private HashMap<Double,RawMessage> nextInThread = new
HashMap<Double,RawMessage>();
private RawMessage previousInThread = null;

My main worry is that each object is being serialized many times, think
of this example:

Objects A & B are in the hashtable
Both objects reference each other.
When A is serialized the reference to B serializes B
When B is serialized the reference to A serializes A

Is this a valid assumption?


readObject and writeObject methods are my number one optimization I'm
think of.

Thanks
Wil

.