How to clone a whole datastructure best?

I have a datastructure which is nested like that

List

--> Class

--> List

--> Class

--> HashMap

as i should compare the data of the original datastructure with the data of the modified datastructure i should be able to copy it to get new references for all objects .. whats the best way to do this?

[354 byte] By [Raydena] at [2007-10-2 4:42:43]
# 1
Use the cloneing facility. Expose a method called copy() and in that method call super.clone() and iterate through the children cloning them one by one and putting the copies into the object you plan on returning.
_dnoyeBa at 2007-7-16 0:47:53 > top of Java-index,Core,Core APIs...