Check out example codes for "loop through java object". It will help you in understanding the concepts better.

Code Example 1

ArrayList<String> namesList = new ArrayList<String>(Arrays.asList( "alex", "brian", "charles") );
         
for(int i = 0; i < namesList.size(); i++)
{
    System.out.println(namesList.get(i));
}

Learn ReactJs, React Native from akashmittal.com