8. List Interface

A List is an ordered Collection (sometimes called a sequence). Lists may contain duplicate elements.

Positional access — manipulates elements based on their numerical position in the list:

    E get(int index);
    E set(int index, E element);    //optional
    boolean add(E element);         //optional
    void add(int index, E element); //optional
    E remove(int index);            //optional
    boolean addAll(int index,
        Collection<? extends E> c); //optional

Search — searches for a specified object in the list and returns its numerical position:

    int indexOf(Object o);
    int lastIndexOf(Object o);

Range-view — performs arbitrary range operations on the list.:

    List<E> subList(int from, int to);

Iteration — extends Iterator semantics to take advantage of the list's sequential nature :

    ListIterator<E> listIterator();
    ListIterator<E> listIterator(int index);

List Algorithms: