<html>
<head>
</head>
<body>
Collections.copy(List dest, List src);<br>
<br>
On 12/10/2002 5:23 AM, <a class="moz-txt-link-abbreviated" href="mailto:duncan.loveday@bt.com">duncan.loveday@bt.com</a> wrote:<br>
<blockquote type="cite" cite="mid:09586341AB62D211A1DA0008C7A4A14409A6EF0F@mcstw1nt03.nat.bt.com">
<pre wrap="">Jason,<br><br></pre>
<blockquote type="cite">
<pre wrap="">Cloning the list should accomplish this. That's what we'd have to do to<br></pre>
</blockquote>
<pre wrap=""><!---->add such a method, and it seems a waste when it's so easy.<br><br>Forgive my ignorance. How would I clone a List ? There's no 'clone()' method<br>on that interface and I wouldn't want to make assumptions about the<br>underlying implementation would I ?<br><br>Also, I'd be concerned about making a deep clone that recursively clones all<br>the elements and sub-elements within the List from a point of view of run<br>time cost. There ought to be a way of just returning a static list of<br>references to the content.<br><br>Cheers,<br><br>Duncan.<br><br>-----Original Message-----<br>From: Jason Hunter [<a class="moz-txt-link-freetext" href="mailto:jhunter@acm.org">mailto:jhunter@acm.org</a>]<br>Sent: 09 December 2002 18:34<br>To: Loveday,DAH,Duncan,YEE24 R<br>Cc: <a class="moz-txt-link-abbreviated" href="mailto:jdom-interest@jdom.org">jdom-interest@jdom.org</a><br>Subject: Re: [jdom-interest] Problem with 'setChildren' on JDOM B8<br><br><br></pre>
<blockquote type="cite">
<pre wrap="">Thanks for this. A couple of observations<br><br>(1) I get no deprecation warnings for setChildren() on compilation and<br></pre>
</blockquote>
<pre wrap=""><!---->don't<br></pre>
<blockquote type="cite">
<pre wrap="">see it as deprecated at<br><br></pre>
</blockquote>
<pre wrap=""><!----><a class="moz-txt-link-freetext" href="http://www.jdom.org/docs/apidocs/org/jdom/Element.html#setChildren(java.util">http://www.jdom.org/docs/apidocs/org/jdom/Element.html#setChildren(java.util</a><br></pre>
<blockquote type="cite">
<pre wrap="">.List)<br></pre>
</blockquote>
<pre wrap=""><!----><br>Yes, it was deprecated after b8. Sorry I didn't notice that. I'm<br>running with latest CVS, and it's deprecated there.<br><br></pre>
<blockquote type="cite">
<pre wrap="">(3) What you suggest would equate in my case to<br><br>elem.setContent(elem.getChildren());<br><br>but this clears both text and element content because of the "live" List<br>returned by getChildren(). When 'setContent()' clears the old content, it<br>also clears the new content it is about to replace it with. It might be<br></pre>
</blockquote>
<pre wrap=""><!---->nice<br></pre>
<blockquote type="cite">
<pre wrap="">to have the option to obtain "non-live" Lists that provide a static<br></pre>
</blockquote>
<pre wrap=""><!---->snapshot<br></pre>
<blockquote type="cite">
<pre wrap="">of the content.<br></pre>
</blockquote>
<pre wrap=""><!----><br>Cloning the list should accomplish this. That's what we'd have to do to<br>add such a method, and it seems a waste when it's so easy.<br><br></pre>
<blockquote type="cite">
<pre wrap="">(4) I would suggest it might also be nice to have methods to clear<br></pre>
</blockquote>
<pre wrap=""><!---->specific<br></pre>
<blockquote type="cite">
<pre wrap="">types of content. For example<br><br> public void removeText()<br></pre>
</blockquote>
<pre wrap=""><!----><br>That might be nice, but it's a slippery slope. I think using the<br>general Filter mechanism is a better solution than specific methods for<br>every type of filter. With filters you could just apply a filter that<br>prefers everything but text.<br><br></pre>
<blockquote type="cite">
<pre wrap="">Hope nobody is offended by any of this.<br></pre>
</blockquote>
<pre wrap=""><!----><br>No way, comments like yours are great. Hope you're not offended by my<br>answers. :-)<br><br>-jh-<br><br><br>_______________________________________________<br>To control your jdom-interest membership:<br><a class="moz-txt-link-freetext" href="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</a><br></pre>
</blockquote>
<br>
</body>
</html>