The copy constructor creates dependent copy
I implemented the copy constructor as it is described here . But still the problem is that when I update route_copy , then the same update is applied to route . So, I don't understand what is wrong in my code? public class Route implements Comparable<Route> { private List<Site> sites; public Route() { sites = new ArrayList<Site>(); } public Route(List<Site> sites) { this.sites = sites; } /** * Copy constructor */ public Route(Route r) { this(r.sites); } public void deleteSite(Site s) { this.sites.remove(s); } } public processData(Route route) { Route route_copy = new Route(route); Site s =