[jdom-interest] Returning List in Element and Document
Sng Wee Jim
weejim at ecquaria.com
Thu Feb 8 01:03:37 PST 2001
I noticed that the List were returned 'live' (see API docs) in the
classes Element and Document. Are there any reasonale behind this?
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.
Don't think the change will cause major performance degradation.
- Jim -
More information about the jdom-interest