CSE373 Data Structures Wi06

Homework 1, due Thursday, 1/12/06, at 11 pm.
No late assignments will be accepted.

For this homework, download the BasicList, BasicListIterator, and BasicArrayList Java files from the course web, and make the following modifications to them.

Your code should not only work properly, but it also should be high-quality. In particular:

What to do

  1. Add method addAll to interface BasicList and class BasicArrayList. Method addAll should have a single parameter of type BasicList, and should add all of the elements from that list to the current list, in the order that they appear in the other list. The other list should not be modified.
  2. Complete the implementation of methods hasPrevious, previous, and remove in class BasicArrayListIterator (which is a nested class in BasicArrayList). Method remove should throw an IllegalStateException if appropriate - including if it is called before any call to next or previous, or called more than once after a call to next or previous. See the JavaDoc pages for the standard Iterator and ListIterator classes for details of how these methods should work and when exceptions should be thrown.
  3. Modify classes BasicArrayList and BasicArrayListIterator so that a ConcurrentModificationException is thrown when an iterator method is called and the underlying list has been modified since the iterator object was created. To simplify things you may assume that only one iterator is created at a time - i.e., you do not need to handle the case where an element is removed by one iterator while another iterator is active.

What to turn in

Turn in your assignment online using the turnin form linked from the course web site (when available). You should include