Issue in modifying the objects of original list?

后端 未结 2 909
一个人的身影
一个人的身影 2021-01-25 03:47

I have faced problem temporary list is also modified while original list content is being changed. Expected result should be \'Employ Original\'.

public static v         


        
2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-25 04:12

    You need to clone the original objects if you want copies. The ArrayList is only making new pointers for new lists. The pointers still only point to the original objects.

提交回复
热议问题