Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » util » [javadoc | source]
java.util
public class: ArrayList [javadoc | source]
java.lang.Object
   java.util.AbstractCollection<E>
      java.util.AbstractList<E>
         java.util.ArrayList

All Implemented Interfaces:
    Cloneable, List, Serializable, RandomAccess, Collection

Direct Known Subclasses:
    HighlightList

ArrayList is an implementation of List , backed by an array. All optional operations adding, removing, and replacing are supported. The elements can be any objects.
Fields inherited from java.util.AbstractList:
modCount
Constructor:
 public ArrayList() 
 public ArrayList(int capacity) 
 public ArrayList(Collection<? extends E> collection) 
    Constructs a new instance of {@code ArrayList} containing the elements of the specified collection. The initial size of the {@code ArrayList} will be 10% higher than the size of the specified collection.
    Parameters:
    collection - the collection of elements to add.
Method from java.util.ArrayList Summary:
add,   add,   addAll,   addAll,   clear,   clone,   contains,   ensureCapacity,   get,   indexOf,   isEmpty,   lastIndexOf,   remove,   remove,   removeRange,   set,   size,   toArray,   toArray,   trimToSize
Methods from java.util.AbstractList:
add,   add,   addAll,   clear,   equals,   get,   hashCode,   indexOf,   iterator,   lastIndexOf,   listIterator,   listIterator,   remove,   removeRange,   set,   subList
Methods from java.util.AbstractCollection:
add,   addAll,   clear,   contains,   containsAll,   isEmpty,   iterator,   remove,   removeAll,   retainAll,   size,   toArray,   toArray,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.ArrayList Detail:
 public boolean add(E object) 
    Adds the specified object at the end of this {@code ArrayList}.
 public  void add(int location,
    E object) 
    Inserts the specified object into this {@code ArrayList} at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this {@code ArrayList}, the object is added at the end.
 public boolean addAll(Collection<? extends E> collection) 
    Adds the objects in the specified collection to this {@code ArrayList}.
 public boolean addAll(int location,
    Collection<? extends E> collection) 
    Inserts the objects in the specified collection at the specified location in this List. The objects are added in the order they are returned from the collection's iterator.
 public  void clear() 
    Removes all elements from this {@code ArrayList}, leaving it empty.
 public Object clone() 
    Returns a new {@code ArrayList} with the same elements, the same size and the same capacity as this {@code ArrayList}.
 public boolean contains(Object object) 
    Searches this {@code ArrayList} for the specified object.
 public  void ensureCapacity(int minimumCapacity) 
    Ensures that after this operation the {@code ArrayList} can hold the specified number of elements without further growing.
 public E get(int location) 
 public int indexOf(Object object) 
 public boolean isEmpty() 
 public int lastIndexOf(Object object) 
 public E remove(int location) 
    Removes the object at the specified location from this list.
 public boolean remove(Object object) 
 protected  void removeRange(int start,
    int end) 
    Removes the objects in the specified range from the start to the end, but not including the end index.
 public E set(int location,
    E object) 
    Replaces the element at the specified location in this {@code ArrayList} with the specified object.
 public int size() 
    Returns the number of elements in this {@code ArrayList}.
 public Object[] toArray() 
    Returns a new array containing all elements contained in this {@code ArrayList}.
 public T[] toArray(T[] contents) 
    Returns an array containing all elements contained in this {@code ArrayList}. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this {@code ArrayList}, the array element following the collection elements is set to null.
 public  void trimToSize() 
    Sets the capacity of this {@code ArrayList} to be the same as the current size.