- #1
Live4eva_2
- 28
- 0
Hi I'm struggling to create a DoublyLinkedList<T> class in Java.
Well,it's actually the iterator that's freaking me out..
Most tutorials and documents I've read use three classes for this:Node<T>,DoublyLinkedList<T> and LinkedListIterator<T>.
I can see the point in creating Node and DoublyLinkedList<T> classes but i don't know why I can't simply just include the 2 iterator reference variables(next and previous) in the DoublyLinkedList<T> class instead of writing an additional iterator class.
Well,it's actually the iterator that's freaking me out..
Most tutorials and documents I've read use three classes for this:Node<T>,DoublyLinkedList<T> and LinkedListIterator<T>.
I can see the point in creating Node and DoublyLinkedList<T> classes but i don't know why I can't simply just include the 2 iterator reference variables(next and previous) in the DoublyLinkedList<T> class instead of writing an additional iterator class.