title: Java: Avoid inserting duplicate in arraylist
body: <p>I am novice to java. I have an <code>ArrayList</code> and I want to avoid duplicates on insertion. My <code>ArrayList</code> is </p>
  
  <pre><code>ArrayList&lt;kar&gt; karList = new ArrayList&lt;kar&gt;();
  </code></pre>
  
  <p>and the the field I want to check is :</p>
  
  <pre><code> kar.getinsertkar().
  </code></pre>
  
  <p>I have read that I can use <code>HashSet</code> or <code>HashMap</code> but I have no clue.</p>