[jdom-interest] Attributes as HashMap?
Alex Chaffee
guru at edamame.stinky.com
Fri Oct 6 09:31:59 PDT 2000
On Thu, Oct 05, 2000 at 01:42:17PM -0700, Jason Hunter wrote:
> > I have a general question:
> > Is there particular reason why choose a LinkedList as attributes in
> > Element, not use a HashMap directly, even an attribute is a name-value
> > pair (as in the java.util.Map)?
>
> As Alex said, a list is probably equivalent or better performance than a
> map until you have many attributes, and a list gives the nice benefit
> that attribute order is maintained (not required but human-friendly).
>
Not to beat the steamy, bloated remains of a large mammal, but
attribute order is actually required for some uses, e.g. comparison
between two documents by a program that doesn't understand XML, like
diff. I think it was Brad Morgan who wanted to use what eventually
became trimText for this very purpose.
--
Alex Chaffee mailto:alex at jguru.com
jGuru - Java News and FAQs http://www.jguru.com/alex/
Creator of Gamelan http://www.gamelan.com/
Founder of Purple Technology http://www.purpletech.com/
Curator of Stinky Art Collective http://www.stinky.com/
More information about the jdom-interest
mailing list