views:

31

answers:

1

Hi all,

I have a variable of type List<RelationHeader>. Now I want to copy all the elements in this list to a new list, but I want to actually copy all the members by value (clone them). Is there a quick command to do this, or do I need to iterate over the list and copy them one at a time?

+1  A: 

You'll have to do this manually. There's no generally accepted way of deep-copying objects in Java (clone() is not really used for this - see this Joshua Bloch article) and you'll have to determine yourself how deep you want to copy those objects.

Brian Agnew