Having trouble loop through a list <set <pair > >
<p>Here is how I declared my list. it.next() appears to be returning my set when it should be returning a pair (which is a string,int pair) in one of my lists. Any ideas?
The method getFirst() is undefined for the type Object..It seems that if I do this , it fixes this. </p>

<p>String m=((Pair) it.next()).getFirst();</p>

<pre><code>List &lt;HashSet&lt;Pair&gt;&gt;  addresses = new ArrayList &lt;HashSet&lt;Pair&gt;&gt; ();

for (int i = 0; i &lt; 100; i++) {
    Iterator it = (addresses.get(i)).iterator();
    while (it.hasNext()){
        String m = it.next().getFirst()); //getFirst returns a string
    }
}
</code></pre>
