I have two lists I need to both iterate at the same time, getting the same n-th element from them. This how I solved:
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
[...]
int idx = 0;
for(Element A : ListA) {
String B = ListB.eq(idx).text();
System.out.println(A.text()+ " " + B);
++idx;
}
In order to return the following output:
A1 B1
A2 B2
...
An Bn
It'd be cleaner if I could extract from ListA
the current n-th element index. But how? I did not find any suitable method.
Any clue? Thanks in advance.