<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.2314.1000" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi all,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> I have a general question:</FONT></DIV>
<DIV><FONT face=Arial size=2> Is there particular reason why choose a
<FONT face="Courier New">LinkedList </FONT>as attributes in Element, not use a
HashMap directly, even an attribute is a name-value pair (as in the <FONT
face="Courier New">java.util.Map</FONT>)?</FONT></DIV>
<DIV><FONT face=Arial size=2> For examaple: </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2>public class Element {</FONT></DIV>
<DIV><FONT face="Courier New" size=2> <FONT
face=Arial>...</FONT></FONT></DIV>
<DIV><FONT face="Courier New" size=2> HashMap
attibutes;</FONT></DIV>
<DIV><FONT face=Arial size=2> ...</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2> public void
setAttribute(String name, String
value) <BR> {
attributes.put(name,value);}<BR> public String
getAttributeValue(String name)</FONT></FONT></DIV>
<DIV><FONT face="Courier New"><FONT
size=2> { return (String)
(attributes.get(name)); }</FONT></FONT></DIV>
<DIV><FONT face="Courier New" size=2>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><FONT face="Courier New">if use HashMap, will it be
faster since we do not use a iterator of the LinkedList to retrieve the
Attribute then call getValue() method? or it does not matter because HashMap has
to internally iterate anyway? (constant-time performence for get/put
operation)</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2><FONT face=Arial size=2>It looks like
the <FONT face="Courier New">org.jdom.Attribute </FONT>class is similar to
<FONT face="Courier New">java.util.Map.Entry,</FONT><FONT face=Arial>
</FONT><FONT face="Courier New">it has two basic method getKey(), getValue(),
which is same with the Attibute class. </FONT></FONT></FONT></DIV>
<DIV> </DIV></BODY></HTML>