ArrayList Constructors
1) ArrayList()
Creates an empty ArrayList.
Example
ArrayList arrayList = new ArrayList();
2) ArrayList(int capacity)
Creates an ArrayList with specified initial capacity.
Example
ArrayList arrayList = new ArrayList(10);
3) ArrayList(Collection c)
Creates an ArrayList containing elements of the collection specified.
Example
ArrayList arrayList = new ArrayList(myCollection);
Where myCollection is an object of the type Collection.
Creates ArrayList of elements containing in the myCollection, in
order returned by the myCollection’s Iterator.
|