title: Using ArrayList or HashMap for better speed
body: <p>I need a 'List' or 'Map',... of object A. This list will be added from another ArrayList. Object A is considered to be equal to another when <code>id</code> parameter of A equals. </p>
  
  <p>My problem is I only want add an object that does not exist in my List. I wonder between the two alternatives for implementation. Using ArrayList or HashMap</p>
  
  <pre><code>1. ArrayList:
  
  for (A a: source) {if (! (a in ArrayList)) addToArrayList();}
  
  2. HashMap &lt;id, A&gt;
  
  for (A a: source) {hasmap.put (a.id, a)}
  </code></pre>
  
  <p>Which will give better speed to add a large number (over 1000 objects, or bigger number of object)
  Is there a better pattern for my problem???</p>