I have two arrayLists for now, and I want to do cross-iterations of them (basically, first iterate the 1st element in the first arrayList, and then iterate the 1st element in the second arrayList, next iterate the 2nd element in the first arrayList etc.). I am wondering how should I achieve this functionality?
Here is a simple test code:
public static void main(String[] args) {
ArrayList first = new ArrayList();
first.add("a");
first.add("c");
first.add("e");
ArrayList second = new ArrayList();
second.add("b");
second.add("d");
System.out.println(first);
System.out.println(second);
}
So basically, I would like to first extract the String a and do some coding, then String b, then String c, then d and e (note that the number of elements in the second arrayList is always one smaller then the first one).
Any hints will be much appreciated :)