[jdom-interest] Element.getMixedContent.addAll(Collection) El
ement.getMixedContent.add(Element)(etc) add TWICE
Kesav Kumar
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.
Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:kesavk at voquette.com
http://www.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
>
> e.g.
> 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
> delegation
>
> Comments??
>
> Mike
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
--
___________________________________________________
Jerry Lawson Virtual Summit, Inc.
Virtual Programmer jerry.lawson at virtualsummit.com
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list