[jdom-interest] Removing elements from an Iterator...
paul at mathweb.org
Fri Jan 5 12:32:38 PST 2001
(new to this list)
I'm currently trying to remove a bunch of elements that satisfy
whatever test... my best way seems to iterate through the elements
with getChildren().iterator() then when an element is targetted...
I'm removing it with the remove() method.
Turns out the getChildren() object is an org.jdom.PartialList which
seems to not care at all about iterator it can give me, which means
it will not relay any operation on this iterator, in particular the
Using getMixedContent().remove(element) is not only slow (as it would
research through the list) but also invalidates my iterator which
will throw an exception next time its next() is called.
Does anyone have more comment on this PartialList class so that I
could understand it a bit better and probably implement this iterator
?? It seems to have hidden "backing" list which is, surprisingly, not
made using a kind of map but is probably filled by hand.
My only alternate solution would be to make not a remover of elements
but a creator... it's a bit less elegant, so to say... And it really
seems an iterator is something good to have with full capacities...
Thanks in advance.
More information about the jdom-interest