Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Doubly Linked List, Need help with methods provided- Java: public class DoublyLinkedList> implements IterableList { private static LocalTime lastChange = LocalTime.now(); private int size; private

Doubly Linked List, Need help with methods provided- Java:

public class DoublyLinkedList> implements IterableList {

private static LocalTime lastChange = LocalTime.now(); private int size; private Node head; private Node tail; public DoublyLinkedList() { super(); tail = null; head = null; } // Node Class private static class Node> { private Item data; private Node next; private Node previous;

public Node(Item data, Node next, Node previous) { this.data = data; this.next = next; this.previous = previous; } }// Node Class End @Override public void clear() { } @Override public void append(Item item) {

} @Override public Item get(int index) { return null; } @Override public boolean contains(Item item) { return false; }

@Override public void prepend(Item item) { }

@Override public int length() { return size; } @Override public boolean isEmpty() { return false; } @Override public Item[] toArray(Item[] array) { @SuppressWarnings("unchecked") Item[] itemArray = (Item[]) Array.newInstance(array.getClass().getComponentType(), size); // add items return itemArray; } // List Part 2 @Override public void reverse() { // TODO Auto-generated method stub }

@Override public void remove(int index) { // TODO Auto-generated method stub }

@Override public void removeFromEnd(int podFromEnd) { // TODO Auto-generated method stub } // List IteratorLab @Override public ListIterator listIterator() { return new DLinkListIterator(); }

@Override public Iterator iterator() { return (Iterator) new DLinkListIterator(); }

private enum IteratorState {Start,Next,Previous,RemoveCalled }; // DLinkListIterator Class public class DLinkListIterator implements ListIterator {

private IteratorState lastMove; private Node previous; private Node next; private int pos = 0; private LocalTime lastChange = LocalTime.now(); public DLinkListIterator() { super(); } @Override public void add(Item item) { }

@Override public boolean hasNext() { return false; }

@Override public boolean hasPrevious() { return false; }

@Override public Item next() { return null; }

@Override public int nextIndex() { return -1; }

@Override public Item previous() { return null; }

@Override public int previousIndex() { return -1; }

@Override public void remove() { }

@Override public void set(Item data) { }

}// DLinkListIterator End

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

=+1 Is the decision fair to employees?

Answered: 1 week ago