How to determine the Number of opend Browser Windows or to iterate between them?

I came now across this thread and found this, what exactly is what I was looking for:

//Get all window handlesSet<String> allHandles = driver.getWindowHandles();
//count the handles Here count is=2
System.out.println("Count of windows:"+allHandles.size());
3 Likes