[jdom-interest] Element.getMixedContent.addAll(Collection) El
ement.getMixedContent.add(Element)(etc) add TWICE
kesavk at voquette.com
Thu Nov 16 09:39:12 PST 2000
I too agree with this. There are no.of times I saw items were added twice
and when i try to remove and item in the list the position alwyas gave me
trouble. I guess we need to write our own linked list implementation rather
than extending from java.util.LinkedList.
650 356 3740
mailto:kesavk at voquette.com
> PartailList ( returned by getMixedContent) is a subclass of LinkedList.
> Many of the methods ( add, addAll, removeAll ... ) perform logic to
> maintain the list ( locally held ( by the super class and in the backing
> store, but the superclass calls back to the child to perform actions
> PartialList.addAll(collection) adds to the backing store and calls
> LinkedList.addAll(Collection) to maintain the list, which calls
> PartialList.addAll(int, Collection) the add the elements at the end,
> which adds to the backing store AGAIN and calls
> LinkedList.addAll(int, Collection) to maintain the list.
> This style of coding in not safe as it would be legitimate for
> LinkedList.addAll(int, Collection) to call add(int, Object) which would
> add it a third time!!!
> As the implementation of LinkedList is not part of its specification
> then inheritance is not a safe mechanism to use for this type of
> behavior, and I would strongly suggest that this gets rewritten to use
> To control your jdom-interest membership:
Jerry Lawson Virtual Summit, Inc.
Virtual Programmer jerry.lawson at virtualsummit.com
To control your jdom-interest membership:
More information about the jdom-interest