[jdom-interest] JDOM BOF at SD West: problem resolving

Jason Hunter jhunter at collab.net
Fri Apr 13 14:04:00 PDT 2001


> I agree completely with Joe on the ArrayList issue. The only case 
> where a linked list
> has an advantage is where you frequently go through the list, 
> adding or removing items as you go. Even here, ArrayList 
> performance will beat SinglyLinkedList except
> for large lists (probably about 20 items or more).

Middle-of-the-list adds and removes are *very* frequent in XML
manipulations.  When using an ArrayList these actions become
heavyweight.

> Using ArrayList would also allow indexed access to children, so 
> that getChild(int index) and getChildCount() methods could be 
> provided. 

No need for them.

getChildren().get(index)
getChildren().size()

And when FilterList (implemented with whatever underlying list) makes it
so you don't have to copy elements, this will be efficient.

-jh-



More information about the jdom-interest mailing list