How to make a separated copy of an ArrayList? [duplicate]
Yes that’s correct – You need to implement clone() (or another suitable mechanism for copying your object, as clone() is considered “broken” by many programmers). Your clone() method should perform a deep copy of all mutable fields within your object. That way, modifications to the cloned object will not affect the original. In your example … Read more