title: XMLAdapter for HashMap
body: <p>I want to convert a list of items inside of my payaload and convert them into a hashmap. Basically, what I have is an Item xml representation which have a list of ItemID. Each ItemID has an idType in it. However, inside my Item class, i want these ItemIDs to be represented as a Map.</p>
  
  <pre><code>HashMap&lt;ItemIDType, ItemID&gt;
  </code></pre>
  
  <p>The incoming payload will represent this as a list </p>
  
  <pre><code>&lt;Item&gt;...
      &lt;ItemIDs&gt;
         &lt;ItemID type="external" id="XYZ"/&gt;
         &lt;ItemID type="internal" id="20011"/&gt;
      &lt;/ItemIDs&gt;
  &lt;/Item&gt;
  </code></pre>
  
  <p>but I want an adapter that will convert this into a HashMap</p>
  
  <pre><code>"external" =&gt; "xyz"
  "internal" =&gt; "20011"
  </code></pre>
  
  <p>I am right now using a LinkedList</p>
  
  <pre><code>public class MapHashMapListAdapter extends XmlAdapter&lt;LinkedList&lt;ItemID&gt;, Map&lt;ItemIDType, ItemID&gt;&gt; {
  
       public LinkedList&lt;ItemID&gt; marshal(final Map&lt;ItemIDType, ItemID&gt; v) throws Exception { ... }
  
       public Map&lt;ItemIDType, ItemID&gt; unmarshal(final LinkedList&lt;ItemID&gt; v) throws Exception { ... }
  
  }
  </code></pre>
  
  <p>but for some reason when my payload gets converted, it fails to convert the list into a hashmap. The incoming LinkedList of the method unmarshal is an empty list. Do you guys have any idea what I am doing wrong here? Do I need to create my own data type here to handle the LinkedList?</p>