Showing posts with label ARRAYLIST in java. Show all posts
Showing posts with label ARRAYLIST in java. Show all posts

Sunday, August 26, 2012

ARRAYLIST in java


ArrayList implements all List operations using List interface and is also accept null values.The ArrayList is re sizable i.e shrinks and grows automatically and it has a capacity .

The class hierarchy is as follow:
---->Java.Lang.Object
      ----->Java.Util.AbstactCollection
                ----->Java.Util.AbstractList
                        ------>Java.Util.ArrayList

The array list contains following methods for implementing different operations



Return typeMethod name
voidadd (int index, Object o)
booleanadd (Object o)
booleanaddAll (Collection c)
booleanaddAll (int index,Collection c)
voidclear ( )
Objectclone ( )
booleancontains (Object o )
Objectget (int index)
intindexOf(Object o)
booleanisEmpty( )
int lastIndexOf( Object o)
Objectremove( int index)
Protected voidremoveRange( int fromIndex, int toIndex)
Objectset (int index, Object o)
intsize ( )
Object [ ]toArray( )
Object [ ] toArray (Object [ ] a)
voidtrimToSize( )