title: Unmarshalling collections in JaxB
body: <p>suppose I have this class:</p>
  
  <pre><code>public class A {
  
      private HashMap&lt;String, B&gt; map;
  
      @XmlElement
      private void setB(ArrayList&lt;B&gt; col) {
          ...
      }
  
      private ArrayList&lt;B&gt; getB() {
          ...
      }
  
  }
  </code></pre>
  
  <p>When trying to unmarshall an xml document to this class using JaxB I notice that instead of calling the setB() method and sending me the list of B instances JaxB actually calls the getB() and adds the B instances to the returned list. Why?</p>
  
  <p>The reason I want the setter to be called is that the list is actually just a temporary storage from which I want to build the map field, so I thought to do it in the setter.</p>
  
  <p>Thanks.</p>