how do i compare element of hashset?
<pre><code>HashSet&lt;String&gt; noDuplicate = new HashSet&lt;String&gt;();
for(int i=0;i&lt;strings.length;i++)
{
     for(int a=0;a&lt;strings2.length;a++)
     {
         if(noDuplicate.get(i).equals(strings2[a]))
             //blahblah code here
     }
}
</code></pre>

<p>but get doesn't work, i'm not sure how to use iterator if that's the method to use to go through the elements of a hashset. I want to do something like:</p>

<pre><code>for(int i=0;i&lt;strings.length;i++)
{
     for(int a=0;a&lt;strings2.length;a=a+2)
     {
         if(node_marked_array.get(i).equals(strings2[a]))
             //blahblah code here
     }
}
</code></pre>

<p>but I was told to use a hashset because of duplicate values.</p>
