Due: Mon, Sep 16, by 11:59pm
|
Due: Thu, Sep 19, 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
Do not write additional methods that are not specified in the assignment and do not call any of the DLinkedList methods from within any other method (it is fine to call isEmpty but do not overuse it).
|
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. |
E removeLast()
Removes the last element in the list. |
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).
Do not write JUnit tests for this method. It will be tested implicitly by other methods.
|
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 write JUnit tests for the methods of this class. They will be tested implicitly by other methods.
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.
Use enhanced for-loop. The should be no mention of Node anywhere in this method.
|
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 the iterator of that list for all possible failing conditions of the methods |
boolean equals(Object other)
Determines if |