[jdom-interest] Returning List in Element and Document

James Duncan Davidson duncan at x180.net
Thu Feb 8 11:56:16 PST 2001


on 2/8/01 1:03 AM, Sng Wee Jim at weejim at ecquaria.com wrote:

> Wouldn't it be better to return them wrapped using
> Collections.unmodifiableList(List) to prevent inadvertent modifications
> to the returned List?
> This ensures that the data within the 2 classes are encapsulated
> properly and modifiable only through public methods provided. This also
> serves to make the API make fool-proof.

But then you would lose the ability to modify the trees using the
oh-so-lovely collection methods.

-- 
James Duncan Davidson
http://x180.net/                                             !try; do();




More information about the jdom-interest mailing list