As per java doc, it returns Set , check below
[code:1f1gvqup]getWindowHandles
java.util.Set<java.lang.String> getWindowHandles()
Return a set of window handles which can be used to iterate over all open windows of this WebDriver instance by passing them to switchTo().WebDriver.Options.window()
Returns:A set of window handles which can be used to iterate over all open windows.[/code:1f1gvqup]
You can convert later to Array of Strings if you need, if you dont want to use iterator
Set<String> ids= driver.getWindowHandles();
String mainWin= (String) ids.toArray()[0];
String popWin= (String) ids.toArray()[1];