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

Rosen, Alex arosen at silverstream.com
Fri Mar 9 07:16:52 PST 2001

If you're not keeping any state in the FilterList, then looping forwards would
be just as problematic, no? Even more so if you didn't cache the size() value.

List foos = element.getChildren("foo");
for (int i=0; i < foos.size(); i++) {

I think this is a *very* common way of doing things (more out of habit that out
of any real benefit over using an Iterator).

I agree with Joe's suggestion, that ArrayLists would likely perform better
overall. They'll certainly have better worst-case performance...


More information about the jdom-interest mailing list