exception – Facing error in one of the selenium assignment I was practicing

Below is the code I wrote in Java to perform a test which involves switching to windows handles.

package com.Practice;

import java.util.Iterator;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Assignment4 {

    public static void main(String() args) {
        System.setProperty("webdriver.chrome.driver", "C:\Users\vikas\Downloads\chromedriver.exe");

        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.get("http://the-internet.herokuapp.com/");
        driver.findElement(By.xpath("(//div(@id='content')/ul)/li(33)")).click();
        driver.findElement(By.cssSelector("a(href*='windows')")).click();
        Set<String> windows = driver.getWindowHandles();
        Iterator<String> it = windows.iterator();
        String parentId = it.next();
        String childId = it.next();
        driver.switchTo().window(childId);
        System.out.println(driver.findElement(By.xpath("//h3(contains(text(),'New Window'))")).getText());
        driver.switchTo().window(parentId);
        System.out.println(driver.findElement(By.xpath("//div(@id='content')/div/h3")).getText());
    }

}

To the best of my knowledge I assume this code is correct but still I am facing error. I am facing no such element exception.

Exception in thread “main” java.util.NoSuchElementException
at java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:760)
at java.base/java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:780)
at com.Practice.Assignment4.main(Assignment4.java:22)