[jdom-interest] Suggestion for new methods for the Element class

Mark J Laird Markl at waterford.org
Tue Oct 31 07:21:26 PST 2000


> I don't see this as much of a performance gain, as getChildren()
> returns the actual list used as storage internally, so
>
>         elem.getChildren().isEmpty()
>
>         elem.getChildren().size()
>
> accomplish the same things, and I would assume is exactly what
> the presumed methods would do.

True enough, depending on the way the code is organized.  If the Element class
maintains a java.util.List for its internal structure and simply returns this list when
the method is called, then the two methods I suggested would only be convenience
methods rather than performance gains.  I wasn't sure if the List was stored internally
and simply returned, or if the List was created on the fly when the method was called.
I guess I could check the source code... :)

Mark




More information about the jdom-interest mailing list