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

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

LinkedList is an implementation of List, backed by a linked list. All optional operations are supported, adding, removing and replacing. The elements can be any objects.
Field Summary
transient  int size     
transient  Link<E> voidLink     
Fields inherited from java.util.AbstractList:
modCount
Constructor:
 public LinkedList() 
 public LinkedList(Collection<? extends E> collection) 
    Constructs a new instance of {@code LinkedList} that holds all of the elements contained in the specified {@code collection}. The order of the elements in this new {@code LinkedList} will be determined by the iteration order of {@code collection}.
    Parameters:
    collection - the collection of elements to add.
Method from java.util.LinkedList Summary:
add,   add,   addAll,   addAll,   addFirst,   addLast,   clear,   clone,   contains,   descendingIterator,   element,   get,   getFirst,   getLast,   indexOf,   lastIndexOf,   listIterator,   offer,   offerFirst,   offerLast,   peek,   peekFirst,   peekLast,   poll,   pollFirst,   pollLast,   pop,   push,   remove,   remove,   remove,   removeFirst,   removeFirstOccurrence,   removeLast,   removeLastOccurrence,   set,   size,   toArray,   toArray
Methods from java.util.AbstractSequentialList:
add,   addAll,   get,   iterator,   listIterator,   remove,   set
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.LinkedList Detail:
 public boolean add(E object) 
    Adds the specified object at the end of this {@code LinkedList}.
 public  void add(int location,
    E object) 
    Inserts the specified object into this {@code LinkedList} 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 LinkedList}, the object is added at the end.
 public boolean addAll(Collection<? extends E> collection) 
    Adds the objects in the specified Collection to this {@code LinkedList}.
 public boolean addAll(int location,
    Collection<? extends E> collection) 
    Inserts the objects in the specified collection at the specified location in this {@code LinkedList}. The objects are added in the order they are returned from the collection's iterator.
 public  void addFirst(E object) 
    Adds the specified object at the beginning of this {@code LinkedList}.
 public  void addLast(E object) 
    Adds the specified object at the end of this {@code LinkedList}.
 public  void clear() 
    Removes all elements from this {@code LinkedList}, leaving it empty.
 public Object clone() 
    Returns a new {@code LinkedList} with the same elements and size as this {@code LinkedList}.
 public boolean contains(Object object) 
    Searches this {@code LinkedList} for the specified object.
 public Iterator<E> descendingIterator() 
    {@inheritDoc}
 public E element() 
 public E get(int location) 
 public E getFirst() 
    Returns the first element in this {@code LinkedList}.
 public E getLast() 
    Returns the last element in this {@code LinkedList}.
 public int indexOf(Object object) 
 public int lastIndexOf(Object object) 
    Searches this {@code LinkedList} for the specified object and returns the index of the last occurrence.
 public ListIterator<E> listIterator(int location) 
    Returns a ListIterator on the elements of this {@code LinkedList}. The elements are iterated in the same order that they occur in the {@code LinkedList}. The iteration starts at the specified location.
 public boolean offer(E o) 
 public boolean offerFirst(E e) 
    {@inheritDoc}
 public boolean offerLast(E e) 
    {@inheritDoc}
 public E peek() 
 public E peekFirst() 
    {@inheritDoc}
 public E peekLast() 
    {@inheritDoc}
 public E poll() 
 public E pollFirst() 
    {@inheritDoc}
 public E pollLast() 
    {@inheritDoc}
 public E pop() 
    {@inheritDoc}
 public  void push(E e) 
    {@inheritDoc}
 public E remove() 
 public E remove(int location) 
    Removes the object at the specified location from this {@code LinkedList}.
 public boolean remove(Object object) 
 public E removeFirst() 
    Removes the first object from this {@code LinkedList}.
 public boolean removeFirstOccurrence(Object o) 
    {@inheritDoc}
 public E removeLast() 
    Removes the last object from this {@code LinkedList}.
 public boolean removeLastOccurrence(Object o) 
    {@inheritDoc}
 public E set(int location,
    E object) 
    Replaces the element at the specified location in this {@code LinkedList} with the specified object.
 public int size() 
    Returns the number of elements in this {@code LinkedList}.
 public Object[] toArray() 
    Returns a new array containing all elements contained in this {@code LinkedList}.
 public T[] toArray(T[] contents) 
    Returns an array containing all elements contained in this {@code LinkedList}. 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 LinkedList}, the array element following the collection elements is set to null.