Arraylist, constructs an empty list with the specified initial capacity.
It uses the object array buffer to store the elements.
if no initial capacity is specified a empty list with capacity of 10is created.
As new items are added to Arraylist, it checks the array size and if there is empty space it copies it there else a new large array is created. and old array is copied to the new one.
elementData = Arrays.copyOf(elementData, size, Object.class);
Further details check ArrayList.class.
Joined: Oct 13, 2005
Madan Mohan Reddy wrote: . . . ...the inner mechanism is like loop to add into object.. . . . but seems to be some looping concept adding data to object..
Welcome to the Ranch
ArrayList does not use a loop for adding or removal, but it does use loops for finding elements.