Possible Duplicate:
How to most elegantly iterate through parallel collections?
Is there an accepted Java equivalent to Python's zip()?
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 ?
Boolean compareCollection(Collection<Object> c1, Collection<Object> c2)
{
//something like -
for (Object ob1 : c1, Object ob2 : c2){
//check if ob1.val == ob2.val
}
return true;
}