get next index in forloop in gave code example
Example: java for loop with index
int index = 0;
for(Element song : question) {
System.out.println("Current index is: " + (index++));
}
int index = 0;
for(Element song : question) {
System.out.println("Current index is: " + (index++));
}