Selecting element from the galalry

I want to click on the png file in the gallary.
the gallary is containg the list of elements
can anyone suggest me how to do this.

String filename = Filename;
if(imageOnGallary.size()==0)
{
System.out.println(imageOnGallary.size());
}
else
{

		for (WebElement element : imageOnGallary	)
		{
			int i=0;
			element=imageOnGallary.get(i).
			
			
			
			}
		}
	
}

Do you want to click on a specific image or on every image at its turn?

Finally I wrote the code. I wanted to click on the one image.

public void SelectOneOFTheJPGImageFromThePath(String Filename){
	
String	filename = Filename;
	if(imageOnGallary.size()==0)
	{
		System.out.println(imageOnGallary.size());
	}
	else
	{
	    
		for (int i = 0 ; i< imageOnGallary.size() ; i++)
		{
			
			
			if(imageOnGallary.get(i).equals(filename));
			{
				
				imageOnGallary.get(i).click();
			
			}
			break;
		}
	
}

}

Move your break statement inside the if statement. Otherwise, always one loop only will get executed.

ok, thnaks for the suggestion

but i have given the break for the loop, when loop finds that elements it will exsit right? otherwise it will keep looping even after finding the element