Q:

How does "PageFactory.initElements(driver, this);" handles List of WebElements?

I just want to know the working of PageFactory.initElements(driver, this) how it populates searchSuggestions webElement and also if I'm not using thread.sleep(500) , it is throwing stale element reference exception with thread.sleep it's working fine.
public SearchObjects(WebDriver driver) 
{
    this.driver = driver;
    PageFactory.initElements(driver, this);
}
@FindBy(id="navbar-query")
WebElement searchBar;

@FindBy(xpath="//div[@class='navbar-suggestionsearch__search-result']")
List<WebElement> searchSuggestions;

public SearchObjects(WebDriver driver) 
{
    this.driver = driver;
    PageFactory.initElements(driver, this);
}
public void searchOnImdb(WebDriver driver, String str) throws InterruptedException
{
    searchBar.sendKeys(str);
    Thread.sleep(500);
}

A:

PageFactory.initElements() only creates proxies for variables marked with annotations @FindBy. This method does not actually search for these elements. For a WebElement, a proxy for WebElement is created similarly for List<WebElement>.
Refer to https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/PageFactory.java method initElements() which calls the method proxyFields(). In this method the decorate() method of Decorator is called - https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/pagefactory/DefaultFieldDecorator.java. In the decorate() method you will find the respective proxies being created with the respective InnvocationHandler. The InnvocationHandler handles the actual searching of elements etc.
Now when something like driver.findElements() is used, it first goes to the proxy which calls the actual method. - https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementListHandler.java and https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java. 
Try and using an explicit wait with ExpectedConditions - https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html. 

