API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util. ArrayList View Source
Author(s)
Josh Bloch
Neal Gafter
Since
1.2
Version
1.56, 04/21/06
Serial
Hierarchy
 Object
      AbstractCollection
          AbstractList
              ArrayList
Implements
 List
 RandomAccess
 Cloneable
 Serializable
Subclasses
Description
public class ArrayList
  Resizable-array implementation of the List interface.
See also:    Collection List LinkedList Vector
Constructors
public ArrayList ()
Constructs an empty list with an initial capacity of ten.
public ArrayList (Collection<Object> c)
  Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
public ArrayList (int initialCapacity)
  Constructs an empty list with the specified initial capacity.
Methods
Hide/Show inherited methods
public boolean add ( E e) [Overrides AbstractList] [Specified in List]
  Appends the specified element to the end of this list.
public void add (int index, E element) [Overrides AbstractList] [Specified in List]
  Inserts the specified element at the specified position in this list.
public boolean addAll (Collection<Object> c) [Overrides AbstractCollection] [Specified in List]
  Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.
public boolean addAll (int index, Collection<Object> c) [Overrides AbstractList] [Specified in List]
  Inserts all of the elements in the specified collection into this list, starting at the specified position.
public void clear () [Overrides AbstractList] [Specified in List]
  Removes all of the elements from this list.
public Object clone ()
  Returns a shallow copy of this ArrayList instance.
public boolean contains (Object o) [Overrides AbstractCollection] [Specified in List]
  Returns true if this list contains the specified element.
public boolean containsAll (Collection<Object> c) [Inherited From AbstractCollection]
  Returns true if this collection contains all of the elements in the specified collection.
public void ensureCapacity (int minCapacity)
  Increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
public boolean equals (Object o) [Inherited From AbstractList]
  Compares the specified object with this list for equality.
public E get (int index) [Specified in List]
  Returns the element at the specified position in this list.
public int hashCode () [Inherited From AbstractList]
  Returns the hash code value for this list.
public int indexOf (Object o) [Overrides AbstractList] [Specified in List]
  Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
public boolean isEmpty () [Overrides AbstractCollection] [Specified in List]
  Returns true if this list contains no elements.
public Iterator< E> iterator () [Inherited From AbstractList] [Specified in AbstractCollection]
  Returns an iterator over the elements in this list in proper sequence.
public int lastIndexOf (Object o) [Overrides AbstractList] [Specified in List]
  Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
public ListIterator< E> listIterator () [Inherited From AbstractList]
  Returns a list iterator over the elements in this list (in proper sequence).
public ListIterator< E> listIterator (int index) [Inherited From AbstractList]
  Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.
public E remove (int index) [Overrides AbstractList] [Specified in List]
  Removes the element at the specified position in this list.
public boolean remove (Object o) [Overrides AbstractCollection] [Specified in List]
  Removes the first occurrence of the specified element from this list, if it is present.
public boolean removeAll (Collection<Object> c) [Inherited From AbstractCollection]
  Removes all of this collection's elements that are also contained in the specified collection (optional operation).
protected void removeRange (int fromIndex, int toIndex) [Overrides AbstractList]
  Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.
public boolean retainAll (Collection<Object> c) [Inherited From AbstractCollection]
  Retains only the elements in this collection that are contained in the specified collection (optional operation).
public E set (int index, E element) [Overrides AbstractList] [Specified in List]
  Replaces the element at the specified position in this list with the specified element.
public int size () [Specified in List]
  Returns the number of elements in this list.
public List< E> subList (int fromIndex, int toIndex) [Inherited From AbstractList]
  Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
public Object toArray () [Overrides AbstractCollection] [Specified in List]
  Returns an array containing all of the elements in this list in proper sequence (from first to last element).
public T toArray ( T a) [Overrides AbstractCollection] [Specified in List]
  Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.
public String toString () [Inherited From AbstractCollection]
  Returns a string representation of this collection.
public void trimToSize ()
  Trims the capacity of this ArrayList instance to be the list's current size.
Fields
Hide/Show inherited fields
protectedtransient int modCount [Inherited From AbstractList]
  The number of times this list has been structurally modified.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar