This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 11
November 18, 2002
Due: Tuesday, November 26 at 11:59 p.m.
Accepted without penalty until: Wednesday, December 4 at 11:59 p.m.
NOT ACCEPTED after Wednesday, December 4 at 11:59 p.m.
Assignment: Add an external iterator for the ArrayList class. This
external iterator reference the ArrayList, but storage requirements
for the iterator are O(1). i.e., storage requirements are constant.
Total point value of assignment: 50 points Extra Credit
This assignment is to be done INDIVIDUALLY.
Assignment: Your ArrayList.java file needs to have the following:
import structure.QueueArray // Bailey's QueueArray implementation
import structure.List; // Bailey's List interface
import structure.Iterator; // Bailey's Iterator interface
public class ArrayList extends QueueArray implements List
{
We may run your iterator against our class ArrayList instead of yours.
Do not assume that head will be at index zero. The value of head
should be as defined in Assignment #7.
You will need to code the elements() method to your ArrayList class.
In a separate file (ArrayListIterator.java) implement an external
iterator for the ArrayList. You will need:
import structure.Iterator
public class ArrayListIterator implements Iterator
{
The Iterator interface is given on page 157 of Java Structures. Your
program should include every method of the interface. The elements
method should send whatever parameters are needed to the constructor
for the iterator.
You will submit both ArrayList.java and ArrayListIterator.java at
the same time using the handin command. Even if your previous
ArrayList.java worked perfectly, submit it again, this time to
Assignment 9.
Grading Rubric:
5 pts. reasonable attempt to solve problem as assigned
5 pts. also compiles (both classes)
5 pts. style standards (includes clarity, comments, etc.)
The following points are available only for code that compiles
and runs without runtime error. Some requirements are:
25 pts. elements() method does NOT copy array from ArrayList.
Instead, a reference to the array must be passed. Only simple
variables and references are passed to Iterator
and code works correctly.
5 pts. elegance of code
5 pts. include a test driver that has three iterators concurrently
traversing the same list.
Other requirements:
The first operation of your main program must be to print "CPSC 210", your name, the assignment number, and a brief description of the assignment.
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Submit your program using the handin command. There is a link to
the handin description on the CPSC 210 lab page (www.cs.clemson.edu/~lab210).