I'm trying to make a linkedList class that implements a deque. I'm really lost on how to do it. this is what i have.
import java.util.*;
public class LinkedListDeque implements Deque {
public LinkedListDeque() {
LinkedList list = new LinkedList();
}
public int size() { return list.size(); }
public boolean isEmpty() { return list.size() == 0; }
public void insertFirst(E e) { list.addFirst(e); }
public void insertLast(E e) { list.addLast(e); }
public E removeFirst() { return list.removeFirst(); }
public E removeLast() { return list.removeLast(); }
public E firstElement() { return list.getFirst(); }
public E lastElement() { return list.getLast(); }
}
Can someone hep me format this properly? I can't figure it out / not sure if it is even remotely correct. I'm trying to