Verify element visible based on list element

I have the following method that takes an int input and clicks on the element

    def static selectItem(int itemIndex) {
	WebUI.waitForElementVisible(findTestObject('dashboard/ItemList'), 7, FailureHandling.STOP_ON_FAILURE);

	final List<TestObject> items =
			CommonUtils.findVisibleElementsFromTestObject(findTestObject('dashboard/ItemList'));

	WebUI.click(items.get(itemIndex));
}

In my test class, I am loading the dashboard page and before clicking a particular item, I want to make sure that it is visible on the screen.

For example,

Dashboard.selectItem(17) should click the 16th item on the list. I know one way is to verify the visibility of the complete list but I am looking for a way to verify visibility of a specific item (16th in my case) from a list.

Is “CommonUtils” a custom class of yours? If so, you should share its source.

What is Dashboard? You haven’t explained it. Is it your custom class? If so, please share the source.

Possibly you should rather use List WebUI.findElements(TestObject) keyword.