[jdom-interest] List's in JDOM - a small essay

Jason Hunter jhunter at collab.net
Fri Mar 9 08:57:12 PST 2001


> I agree, if you commondly (almost always) insert at
> the back of the list you must have a lastItem reference.

The list will cache the last element so add's are fast.  But that last
element won't hold a ptr to the previous element, so you can't iterate
backward.

Using a singly linked list saves quite a lot of memory and actually from
prelim testing makes the add() operation twice as fast (due to fewer
pointer manipulations).  Personally, think a singly linked list is a
good idea because of these benefits and the fact I've never needed to
iterate a list backward.  If you've found need to iterate a list
backward, please follow up to this post and explain why.

-jh-



More information about the jdom-interest mailing list