So the problem is that after I add All items to my new arrayList2 and change something in arrayList1 it makes the same change in arrayList2. My goal is to basically clone all items from arraylist1 and after I change something in it, items in arraylist2 remain the same as after addAll command. Example of my encounter challenge:
arraylist2.addAll(arrayList1)
arraylist2[0].arrayCoordinates // [0, 0]
arraylist1[0].arrayCoordinates = arrayOf(1, 1)
arraylist2[0].arrayCoordinates // [1, 1]
Thanks for the help in advance.