project4
Interface ILinkedList<E>

Type Parameters:
E -
All Known Implementing Classes:
LinkedList

public interface ILinkedList<E>

Provides basic functionalities of a generic linked-list

Author:
nguyencao

Nested Class Summary
static class ILinkedList.OrderIndexOutOfBoundsException
          throw this exception when an invalid index is used (like ArrayIndexOutOfBoundsException)
 
Method Summary
 E get(int indx)
          Get the item at index indx
 void insert(E item, int indx)
          Insert an item into index indx
 void insertHead(E item)
          Insert item to the head of the list
 void insertTail(E item)
          Insert item to the end of the list
 boolean isEmpty()
          determines if the list is empty or not
 E remove(int indx)
          Remove an item from the list
 int size()
           
 

Method Detail

insertHead

void insertHead(E item)
Insert item to the head of the list

Parameters:
item -

insertTail

void insertTail(E item)
Insert item to the end of the list

Parameters:
item -

insert

void insert(E item,
            int indx)
            throws ILinkedList.OrderIndexOutOfBoundsException
Insert an item into index indx

Parameters:
item: - item of type E to be inserted
indx: - index in the list to be inserted
Throws:
ILinkedList.OrderIndexOutOfBoundsException

remove

E remove(int indx)
         throws ILinkedList.OrderIndexOutOfBoundsException
Remove an item from the list

Parameters:
indx: - index of the item need to be removed.
Returns:
the item of type E
Throws:
ILinkedList.OrderIndexOutOfBoundsException

get

E get(int indx)
      throws ILinkedList.OrderIndexOutOfBoundsException
Get the item at index indx

Parameters:
indx: - index in the list to get the item
Returns:
the item of type E
Throws:
ILinkedList.OrderIndexOutOfBoundsException

size

int size()
Returns:
the number of items in the list

isEmpty

boolean isEmpty()
determines if the list is empty or not

Returns:
true of the list is empty, false otherwise