Home Java SCJP SCWCD Servlet Submit News Contact Us Site Map


Over 500 magazines for free (including Oracle Magazine)!

Yes all of them are FREE. You can subscribe to ALL of them.
Click here to apply today!

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.

<< Java ArrayList

Adding Elements to Java ArrayList >>

Home Java SCJP SCWCD Servlet Site map