Assignment : IterableList<E>
Collaboration: Complete this project only with help from UofA section Leaders and the course materials (books, presentations, code demos). Do not give your code to anyone or copy any code. Do not even look at another person's computer screen! Copying code from another person’s screen is a violation of the code of academic integrity. You may use code from Rick's book, presentations code demos, lectures, or section.
// Return how many elements are in this IterableList
publicint size() // Completed in lecture;is in the starter project
// Add data before all other elements in the double linked structure
publicvoid addLast(E data) // Completed in lecture;is in starter project
// Add data before all other elements in the double linked structure
public String toString() // Completed in lecture; is in starter project
// Add data before all other elements in the double linked structure
publicvoid addFirst(E data)
// Return and remove the first element from the doubly linked structure
public E removeFirst() throws NoSuchElementException
// Return and remove the last element from the doubly linked structure
public E removeLast() throws NoSuchElementException
You are also asked to complete two inner classes that allow anyone to iterate over the elements in an IterableList in either a forward or reverse manner
// Completed in lecture, and in the starter project
privateclass ReverseItr implements ReverseIterator<E>
privateclass ForwardItr implements ForwardIterator<E>
A Picture of memory: You implementation must use a doubly-linked data structure. The following code will generate a doubly-linked structure and generate the output shown:
IterableList<String> list = new IterableList<String>();
list.addFirst("Alex");
list.addLast("Zion");
list.addFirst("Sage");
list.addLast("Kai");
list.addLast("TO BE REMOVED");
assertEquals("TO BE REMOVED", list.removeLast());// Like pop(), remove and return an element
assertEquals(4, list.size());
ForwardIterator<String> fitr = list.forwardIterator();
while (fitr.hasNext())
System.out.print(fitr.next() + " ");
System.out.println();
ReverseIterator<String> ritr = list.reverseIterator();
while (ritr.hasPrev())
System.out.print(ritr.prev() + " ");
Start with an Eclipse Project with Four Files: To get a fast start and avoid writing a unit test with 248 assertions, start withan archive file as an Existing Eclipse Project:
•Download an Eclipse project as an archive file where it can be easily found
•From Eclipse, select File > Import > General > Existing Projects into Workspace > Next
•Click the radio button to the left of Select archive file and click the Browse… button to the right
•Browse to IterableListStart.zip file you just downloaded
•Click the Finish button.
•You should see project IterableListStart. Expand it to verify it has these four files:
•You should rename your project to IterableList
•From Eclipse, select Refactor > Rename and enter IterableList
Grading Criteria (40 points, subject to change)
____+40Web-Cat correctness and code coverage: To earn40 points, you will need 100% code coverage and 100% problem coverage (Rick's tests pass and you exercised all methods). These 40 points are derived from Web-Cat. You may submit as many times as you wish until you have 100% on both. Notice that a multiplication feature is employed that means 90% code coverage and 90% problem coverage results in 0.9 * 0.9 * 40 for 36/40 points.
_____/ -40 If you did not use a doubly-linked structure of Node. You will receive a 0 for not using a doubly-linked data structure .The main goal of this assignmentis to learn how to use the doubly-linked structure to store a collection of elements and to help you prepare for the test.