Arraylist


import java.util.ArrayList;
import java.util.Iterator;

public class ArrayListDemo {

    public static void main(String[] args
    {
        ArrayList list=new ArrayList();
        for (int i = 0; i < 10; i++
        {
            list.add(i);    // adds elements to the arraylist
        }        
        Iterator i = list.iterator();   // Iterators provide a standard way to loop through all items in a collection, regardless of the type of collection
        while (i.hasNext()) 
               System.out.println(i.next());   

    }
}

Output:
0
1
2
3
4
5
6
7
8
9