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

前端 未结 7 1705
-上瘾入骨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/ .

    0 讨论(0)
提交回复
热议问题