Due: Mon, Feb 12, by 11:59pm
|
Due: Thu, Feb 15, by 11:59pm
|
DLinkedList
class. In addition make sure that:
DLinkedList
methods are documented using the Javadoc
styleDLinkedList
methods are organized and tested rigorously using the JUnit frameworkHere are the examples from class:
SLinkedList.java
SLinkedListTest.java
video on addLast( 3 ) in multi
video on addLast( 3 ) in single
video on addLast( 3 ) in empty
:: NOT allowed to call any of the DLinkedList methods from within any other method. |
void addFirst() or void addLast()
From Assignment 2 you only need one of these methods to be correct. Adjust method |
E removeFirst()
Removes the first element in the list. JUnit: _?_ cases |
E removeLast()
Removes the last element in the list. JUnit: _?_ cases |
E remove(int index)
Removes the element at the given
|
boolean removeAll(E item)
Removes all occurrences of the given |
Iterator<E> iterator()
Returns an instance of
DListIterator (see below).
|
DListIterator class
Inner class for creating iterator objects that supports all operations in the Iterator interface.
Hint: Only one pointer as data member is needed to implement the iterator.
Start by implementing only the iterator methods
next() and hasNext() . Later implement remove() .
Do not need to include a JUnit test for this method. It will be tested implicitly in JUnit by testing the method containsIter(...)
Class examples: Stack.java, IteratorTest.java
|
boolean containsIter(E item)
Same as
contains but uses an iterator over this list to visit the nodes as it searches for the item.
The should be no Node code anywhere in this method.
JUnit: 7 cases, same as contains
|
void remove()
Implement the method |
boolean removeAllIter(E item)
Same as |
@Test void test_iterFails()
Add this method in the Tester class. For each type of list (empty, single, multi), it tests that list's iterator for all possible failing conditions of the methods |
boolean equals(Object list)
Determines if |