Please send questions to
st10@humboldt.edu .
public interface Cs132List
{
// Purpose: returns true iff list has no elements
public boolean isEmpty();
// Purpose: returns number of elements in the list
public int size();
// Purpose: add given data newElement to beginning of list.
public void addFirst(Object newElement);
// Purpose: add given data newElement to end of list.
public void addLast(Object newElement);
// Purpose: add given data newElement to list at position index (where
// 0 is the index of the first item in the list, 1 is the
// index of the 2nd item in the list, etc.)
// What if the index is not inside the given list?
// For now, we'll defer that.
// BUT note --- those elements "after" this position ARE
// shifted "up" a position!
public void add(int index, Object newElement);
// Purpose: IF list is not empty, return FIRST element in list.
// (we're deferring, for NOW, what to do if list IS empty.)
public Object getFirst();
// Purpose: IF the list is not empty, return the LAST element in list.
// (we're deferring, for NOW, what to do if the list IS empty.)
public Object getLast();
// Purpose: return the element at position index in the list
// (where 0 is the index of the first item in the list).
// If the index is not within the bounds of this list,
// return null.
public Object get(int index);
// Purpose: This seeks to remove the element at position index
// of the list (where 0 is the index of
// the first element in the list). It will do so and return
// true if the index is indeed a position in the list and
// if the list is not empty --- otherwise, it will return
// false and the calling list will remain unchanged.
// (elements "above" this in the list are now one
// position "lower")
public Object remove(int index);
// Purpose: empties the list
public void clear();
}