[jdom-interest] Moving Children

Jason Hunter jhunter at collab.net
Thu Jun 14 14:51:02 PDT 2001


> How do I clone the List?

list.clone()

> // Assume creation of two Elements usersA and usersB, each with children
> 
> Element clone = (Element)usersA.clone();
> 
> java.util.List listA = clone.getChildren();
> java.util.List listB = usersB.getChildren();

That clones the element, not the list.  So that's only appropriate if
you want to copy, not move.  A list clone is fast because it's just a
raw copy of the element pointers contained within.

-jh-



More information about the jdom-interest mailing list