Question: public class LinkedList { private Node head; private Node tail; private Node current; private int size; // Exceptions to throw private static final Exception ListEmpty

public class LinkedList {

private Node head;

private Node tail;

private Node current;

private int size;

// Exceptions to throw

private static final Exception ListEmpty = new Exception("List empty");

private static final Exception ListNoNextItem = new Exception("No next item -- at tail");

private static final Exception ListNoPrevItem = new Exception("No prev item -- at head");

private static final Exception ListItemNotFound = new Exception("List item not found");

private static class Node {

int value;

Node prev;

Node next;

public Node(int val, Node p, Node n) {

this.value = val;

this.prev = p;

this.next = n;

}

public Node(int val) {

this(val, null, null);

}

}

public LinkedList() {

head = tail = current = null;

size = 0;

}

public boolean isEmpty() {

return size == 0;

}

public int size() {

return size;

}

public boolean contains(int item) {

//do code

}

public void append(int item) {

//do code

}

public void prepend(int item) {

//do code

}

public void findNext(int item) {

//do code

}

public void findPrev(int item) {

//do code

}

public int get() throws Exception {

//do code

}

public int getHead() throws Exception {

//do code

}

public int getTail() throws Exception {

//do code

}

public int getTail() throws Exception {

//do code

}

public int getNext() throws Exception {

//do code

}

public int getPrev() throws Exception {

//do code

}

public void insert(int item) {

//do code

}

public void add(int item) {

//do code

}

public void remove() throws Exception {

//do code

}

public void remove(int item) throws Exception {

//do code

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!