[jdom-interest] List in Element

Jason Hunter jhunter at acm.org
Fri Jun 29 11:34:24 PDT 2001


Guillaume Pothier wrote:
> 
> protected List checkContent ()
> {
>         if (content == null) content = new AraryList (5);
>         return content;
> }
> 
> protected List checkAttributes ()
> {
>         if (attributes == null) attributes = new ArrayList (5);
>         return attributes;
> }
> 
> //...
> }
> 
> That would allow me to just subclass a couple of methods instead of having to
> check in the source code of Element to see where these members are
> instantiated.

Sounds good.  Why don't you submit a patch?  I wonder if the names could
be something more descriptive.

> And just another little remark : for the same purpose, the INITIAL_CAPACITY
> (or something) should be declared protected instead of private.

If all the construction is done in the same method, there's no need for
the static.

-jh-



More information about the jdom-interest mailing list