Issue in modifying the objects of original list?

后端 未结 2 1417
天涯浪人
天涯浪人 2021-01-25 03:49

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:24

    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.

提交回复
热议问题