edu.rice.comp211.laundry.list
Interface ListI<T>

Type Parameters:
T - the type of elements held by this list
All Superinterfaces:
EnumI<T>
All Known Subinterfaces:
BiListI<T>
All Known Implementing Classes:
BiList, SyncBiList

public interface ListI<T>
extends EnumI<T>

A mutable linear list of elements of type T that can be scanned from first (front) to last (rear). This interface is easily implemented as a singly linked list. This list always includes a dummy node preceding the first element (following the last element) and behaves as if it is circular when scanned by an iterator.


Method Summary
 ListI<T> insertFront(T o)
          Inserts the object o at the front of this list
 ListI<T> insertRear(T o)
          Inserts the object o at the rear of this list.
 int length()
          The number of elements in the list
 IteratorI<T> newIterator()
          Factory method that instantiates a new iterator over this list.
 ListI<T> newList()
          Factory method to instantiate a new empty list that can hold the same type of element.
 T remFront()
          Removes the element at the front of the list.
 
Methods inherited from interface edu.rice.comp211.laundry.list.EnumI
isEmpty
 

Method Detail

newList

ListI<T> newList()
Factory method to instantiate a new empty list that can hold the same type of element.

Returns:
a new empty list.

length

int length()
The number of elements in the list

Returns:
the length of this list.

insertFront

ListI<T> insertFront(T o)
Inserts the object o at the front of this list

Parameters:
o - the object to insert
Returns:
this list .

insertRear

ListI<T> insertRear(T o)
Inserts the object o at the rear of this list.

Parameters:
o - the object to insert
Returns:
this list .

remFront

T remFront()
Removes the element at the front of the list.

Returns:
the removed element.

newIterator

IteratorI<T> newIterator()
Factory method that instantiates a new iterator over this list.

Specified by:
newIterator in interface EnumI<T>
Returns:
The inherited newIterator method with a narrowed output type