Java 2D arrayList - copy last element, update it and add the updated version at the end of the list : The problem is kinda weird. I have a 2D arrayList. Where each element has an int called x and other called y. What i am trying to do is get the last element of 2DarrayList and update the x and y values and add the updated element right at the end of 2d arrayList.

The problem is when i update the last element, it also updates the element from where it is retrieving info from. I don't want the info. of the element to change from where the info is being derived from.