net.datastructures - version 5.0

net.datastructures
Interface IndexList<E>

All Known Subinterfaces:
Sequence<E>
All Known Implementing Classes:
ArrayIndexList

public interface IndexList<E>

An interface for array lists.

Author:
Roberto Tamassia, Michael Goodrich

Method Summary
 void add(int i, E e)
          Inserts an element e to be at index i, shifting all elements after this.
 E get(int i)
          Returns the element at index i, without removing it.
 boolean isEmpty()
          Returns whether the list is empty.
 E remove(int i)
          Removes and returns the element at index i, shifting the elements after this.
 E set(int i, E e)
          Replaces the element at index i with e, returning the previous element at i.
 int size()
          Returns the number of elements in this list.
 

Method Detail

size

int size()
Returns the number of elements in this list.


isEmpty

boolean isEmpty()
Returns whether the list is empty.


add

void add(int i,
         E e)
         throws IndexOutOfBoundsException
Inserts an element e to be at index i, shifting all elements after this.

Throws:
IndexOutOfBoundsException

get

E get(int i)
      throws IndexOutOfBoundsException
Returns the element at index i, without removing it.

Throws:
IndexOutOfBoundsException

remove

E remove(int i)
         throws IndexOutOfBoundsException
Removes and returns the element at index i, shifting the elements after this.

Throws:
IndexOutOfBoundsException

set

E set(int i,
      E e)
      throws IndexOutOfBoundsException
Replaces the element at index i with e, returning the previous element at i.

Throws:
IndexOutOfBoundsException

net.datastructures - version 5.0