Lab 7
Due 9:40AM Wednesday October 29, 2008
- Implement a LinkedList class containing the following
methods:
public void insert(Object o)
-
inserts o at the beginning of the list
public void insertAt(Object o, int index)
- inserts o at the given index. If index is greater than the
size of the list, insert o at the end of the list.
public boolean find(Object o)
-
returns true if o is in the list
public void removeAt(int index)
-
remove the element at the given index. If the index is
outside the bounds of the list, do nothing.
public void remove(Object o)
-
remove the first occurence of o from the list. If o is not in
the list, do nothing.
public void append(Object o)
-
insert o at the end of the list.
public String toString()
- create
a string
representation of the list which contains a left parenthesis followed
by the result of calling toString() on each element in the list
followed by a right parenthesis.
public int size()
- return
the number of elements in the list.
public void reverse()
- reverse
the list.
Sami
Rollins