Hello friends,
One has to specify the size for normal arrays. The Collection class ArrayList is a wrapper over Object []. With Decorator
pattern it is extending the functionality of the general arrays.
If you observe the
java source, the constructor for arraylist is ,
/**
* Constructs an empty list with an initial capacity of ten.
*/
public ArrayList() {
this(10);
}
And
/**
* The array buffer into which the elements of the ArrayList are stored.
* The capacity of the ArrayList is the length of this array buffer.
*/
private transient Object elementData[];
/**
* The size of the ArrayList (the number of elements it contains).
*
* @serial
*/
private int size;
So, I think you got very clear view.
Thank you.