How to copy values, not references, of List into another list?

前端 未结 7 1706
-上瘾入骨i
-上瘾入骨i 2021-01-31 18:52

Namely, without referencing the same object, I need to copy values of elements of one list into another list. These are the lists:

List listA = ne         


        
7条回答
  •  一生所求
    2021-01-31 19:54

    You won't have a lot of luck with clone() and Cloneable - it will only create a shallow copy. You could use something like this - http://javatechniques.com/blog/faster-deep-copies-of-java-objects/ .

提交回复
热议问题