How to iterate over two Collections of Objects simultaneously?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1365793/how-to-most-elegantly-iterate-through-parallel-collections">How to most elegantly iterate through parallel collections?</a><br>
  <a href="http://stackoverflow.com/questions/2118932/is-there-an-accepted-java-equivalent-to-pythons-zip">Is there an accepted Java equivalent to Python&#39;s zip()?</a>  </p>
</blockquote>



<p>I have to iterate simultaneously over two Collections of objects to see if their members are equal. Is there a way of using a counter to access the object or do something similar to the for loop below ?</p>

<pre><code>Boolean compareCollection(Collection&lt;Object&gt; c1, Collection&lt;Object&gt; c2)
{
     //something like -
     for (Object ob1 : c1, Object ob2 : c2){
           //check if ob1.val == ob2.val
     }
     return true;
}
</code></pre>
