E.g.
for(String str : list1) { ... } for(String str : list2) { ... }
suppose we are sure that list1.size() equals list2
list1.size()
list2
You can't traverse two lists at the same time with the enhanced for loop; you'll have to iterate through it with a traditional for loop:
for
for (int i = 0; i < list1.size(); i++) { String str1 = list1.get(i); String str2 = list2.get(i); ... }