2 edited title
| link

Compilation error when storing list size in to an intiterating through While loop, compilation error at line no. 10, start of While loop

1
source | link

Compilation error when storing list size in to an int

I am getting compilation error when trying to store list size value into an int.

public class HandleWebTable {

private static WebDriver driver;

public HandleWebTable(){
    super();
}

public static void printAllHeaderOfWebTable() {

List<WebElement> allHeaderTable=driver.findElements(By.xpath("//div[@class='panel history-panel panel panel-default']"));

int allHeaderSize=allHeaderTable.size();

ListIterator<WebElement> tr=allHeaderTable.listIterator();

System.out.println("Traverse in forwrd direction");

While(tr.hasNext()) { //getting compilation error here, asking to add ;

    System.out.println("index" + tr.nextIndex() + "value" + tr.next());
}

please help what should be the right approach to get the rows and columns of webtable.