I want the iteration to skip the first few elements. elements is a List<WebElement>. I would like to iterate through the list not from the beginning, but starting from somewhere in the middle, how could I do that?
for ( WebElement element : elements )
{
//block of code
}
For many cases where you want to apply some operation to a specific range of
List, you can usesubList():This also works fine for removing some range:
Note that
subListonly exists onList, so this won’t work on aSetor other non-ListCollectionobjects.