iterator ( ) ; //use hasNext() and next() methods of Iterator to iterate through the elements It does not allow duplicates and uses Hashtable internally. Here, we use the for loop to go through every ModelClass object inside modeList and call the getName() function, which returns the name. ArrayList’s size – 1 because ArrayList index starts with 0) and go up to the first index (which is 0) as given below. This is one of the most important knowledge in dealing with list and arrays on how to loop for each elements.