H.A.20.1 - ArrayList

ArrayList Methods

 

 

 

int size();                    // Returns the number of elements

                               // currently stored in the list

 

boolean isEmpty();             // Returns true if the list is empty,

                               // otherwise returns false

 

boolean add(Object obj);       // Appends obj at the end of the list;

                               // returns true

 

void add(int i, Object obj);   // Inserts obj before the i-th element;

                               // increments the indices of the

                               // subsequent elements by 1

 

Object set(int i, Object obj); // Replaces the i-th element with obj;

                               // returns the old value

 

Object get(int i);             // Returns the value of the i-th

                               // element

 

Object remove(int i);          // Removes the i-th element from the

                               // list and returns its old value;

                               // decrements the indices of the

                               // subsequent elements by 1

 

 

Note: this is an incomplete list: see http://java.sun.com/j2se/1.4.1/docs/api/java/util/ArrayList.html for the entire list.