Hello. I tried to remove an unwanted entry in my list of actors using the remove() method of the TreeSet class, but it did not work. I have a W in the list because of tests I did to serialize the list. I added the line this.remove("W");
# When a Serializable object is written with writeObject, then modified and written a second time, why is the modification missing when the stream is deserialized?
The ObjectOutputStream class keeps track of each object it serializes and sends only the handle if the object is written into the stream a subsequent time. This is the way it deals with graphs of objects. The corresponding ObjectInputStream keeps track of all of the objects it has created and their handles so when the handle is seen again it can return the same object. Both output and input streams keep this state until they are freed.
Alternatively, the ObjectOutputStream class implements a reset method that discards the memory of having sent an objecct, so sending an object again will make a copy.
Java Serialization FAQ You were probably having the same problem here as well.