I have some data stored as ArrayList. And when I want to backup this data,java bounds two objects forever. Which means when I change values in data ArrayList this changes come to backup. I tried to copy values from data separately to backup in the loop, tried to use method data.clone() — nothing helps.
I have some data stored as ArrayList . And when I want to backup
Share
I think you need to
.clone()the individual objects. Cloning theArrayListis not ‘deep’; it will only clone the references to the object.