This class implements the
List interface in terms of a doubly linked list.
In Java 5.0, it also implements the Queue
interface and uses its list as a first-in, first-out (FIFO) queue.
LinkedList is a generic type, and the type
variable E represents the type of the
elements of the list. LinkedList supports all
optional methods of List, Queue
and Collection and allows list elements of any
type, including null (in this it differs from most
Queue implementations, which prohibit
null elements).
Because LinkedList is implemented with a linked
list data structure, the get( ) and set(
) methods are substantially less efficient than the same
methods for an ArrayList. However, a
LinkedList may be more efficient when the
add( ) and remove( ) methods
are used frequently. The methods of LinkedList are
not synchronized. If you are using a
LinkedList in a multithreaded environment, you
must explicitly synchronize any code that modifies the list or obtain
a synchronized wrapper object with
Collections.synchronizedList( ).
In addition to the methods defined by
the List interface, LinkedList
defines methods to get the first and last elements of the list, to
add an element to the beginning or end of the list, and to remove the
first or last element of the list. These convenient and efficient
methods make LinkedList well-suited for use as a
stack or queue. See List and
Collection for details on the methods of
LinkedList. See also ArrayList.

public class LinkedList<E> extends AbstractSequentialList<E>
implements List<E>, Queue<E>, Cloneable, Serializable {
// Public Constructors
public LinkedList( );
public LinkedList(Collection<? extends E> c);
// Public Instance Methods
public void addFirst(E o);
public void addLast(E o);
public E getFirst( );
public E getLast( );
public E removeFirst( );
public E removeLast( );
// Methods Implementing List
public boolean add(E o);
public void add(int index, E element);
public boolean addAll(Collection<? extends E> c);
public boolean addAll(int index, Collection<? extends E> c);
public void clear( );
public boolean contains(Object o);
public E get(int index);
public int indexOf(Object o);
public int lastIndexOf(Object o);
public ListIterator<E> listIterator(int index);
public boolean remove(Object o);
public E remove(int index);
public E set(int index, E element);
public int size( );
public Object[ ] toArray( );
public <T> T[ ] toArray(T[ ] a);
// Methods Implementing Queue
5.0 public E element( );
5.0 public boolean offer(E o);
5.0 public E peek( );
5.0 public E poll( );
5.0 public E remove( );
// Public Methods Overriding Object
public Object clone( );
}