Will addAll function in Java make a copy

后端 未结 3 792
我寻月下人不归
我寻月下人不归 2021-02-07 00:16

When list.addAll(list2) is called will objects in lists be copied to list? or just copy their references... did not find any explanation on javadoc...

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 00:29

    No copy of the objects or their data are made; their references are simply added to the list object.

提交回复
热议问题