[jdom-interest] Why don't Comment, Element, Text, etc extend common jdom object?

bob mcwhirter bob at werken.com
Mon May 27 21:19:04 PDT 2002


I'm just guessing, as I'm not overly familiar with the FilterList
stuff, but...

I imagine it should be somewhat possible to implement an Iterator
that doesn't use the underlying collection's Iterator, but rather
indices, to avoid concurrent modification exception.  In that case,
there's only 1 iterator, which is completely under our control. 
And for remove(), it delegates to detach(). 

This would also make an argument for a common interface which includes
the detach() method.  If unsupported (ie, Document.detach()), it'd be
legal to throw an UnsupportedOperationException.

Then again, I could be completely wrong.

	-bob


On Mon, 27 May 2002, Elliotte Rusty Harold wrote:

> 
> >Can anyone think of a way for either detach() or Iterator::remove() to be
> >legal?
> >
> 
> DOM tree walkers and node iterators have no problem with this use 
> pattern. However, they don't use the collections API. Off the top of 
> my head, I can't see how to make this work without ditching the 
> Collections API and rolling our own; but then I don't really know a 
> lot about the Collectios API so maybe it's possible.
> -- 
> 
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
> |             http://www.cafeconleche.org/books/bible2/              |
> |   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
> |  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
> +----------------------------------+---------------------------------+
> 




More information about the jdom-interest mailing list