CSci 2101 Lab 5. Finishing linked list class; practice with Eclipse

Due Monday March 7th at 11:59pm

50 points

Work in groups. You must use Eclipse.

Start by creating an Eclipse project with the Linked list setup classes (copy from here) and the starting point for our linked list class here.

Lab tasks

  1. Implement the method get. Test it by adding several elements to the list at index 0 and getting elements at different positions. Don't forget to throw an exception if needed (as specified in the method description)
  2. Finish implementing the method add. Carefully test it with your get method.
  3. Add and implement a toString method for the linked list that prints all of its elements.
  4. Change the OurList interface so that the interface declaration is public interface OurList<E> extends Iterable<E>. Use Eclipse to generate the needed method in the OurLinkedList class. Add an enchanced for loop into the testing class to print all the list elements.
  5. Implement the private inner Iterator class in the linked list, implement its methods (except "remove"). See examples we did in class. Do not use the linked list get method since it would start traversing the list from the beginning for every next element.
  6. Implement the linked list remove method. Carefully test it. The iterator class and toString methods may be helpful here.
  7. New: implement a method equals in OurLinkedList class that takes an object and returns true if that object is an instance of OurLinkedList and has the exact same elements (as given by calling equals method on the respective elements) in the same order and false otherwise. If two lists are of different size, the method returns false. You may assume that your list does not contain null elements.
  8. Check your code for style and methods documentation before submitting.

How to submit:

Send me all of the code you worked on at the end of the lab (CC your group). The lab grade is based on in-class activities and the code sent to me at the end of the lab (or, if final, incorporated into the solution).

CSci 2101 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.