how to traverse array list code example
Example 1: java arraylist loop
for (int counter = 0; counter < arrlist.size(); counter++) {
System.out.println(arrlist.get(counter));
}
Example 2: how to loop through arraylist of objects in java
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));
}