I am new to test automation and i am currently working on a personal project

I have this method in which it finds all the links for a section on the page, clicks on each link, irritates through each tab and then gets the title of each page

However, i want a way to verify the titles of these links against a list of expected titles

What would be the best approach to modify this in order to do this? would it be better to store in an array and then assert/verify each title separately? 

I have tried a few ways to assert by changes return type to String and also to List but with no luck

```
public void linksAreWorkingDashBoardLeftPanal() throws Exception {

    List<WebElement> li_All = links_myAccountNav.findElements(By.tagName("a"));
    for(int i = 0; i < li_All.size(); i++){

        String clickOnLinkTab = Keys.chord(Keys.CONTROL, Keys.ENTER);
        links_myAccountNav.findElements(By.tagName("a")).get(i).sendKeys(clickOnLinkTab);
        Thread.sleep(5000);

    }

    //Opens all the tabs
    Set<String> getTitleinWindow = driver.getWindowHandles(); 
    Iterator<String> it = getTitleinWindow.iterator();

    while(it.hasNext())
    {

          driver.switchTo().window(it.next());
          System.out.println(driver.getTitle());
    }

```