public char deleteItem() {//since previous is already in the Links, switching the code around allows for a Queue implementation fairly trivially
       char temp;
        if (stack) {//this is the stack implementation, which is the assignment
            if (isEmpty()) throw new EmptyStackException();
            temp = (char) pointer.getDatum();
            if (pointer.getNext() == pointer) {
                pointer = null;
                return temp;
            }
            pointer.getNext().setPrevious(pointer.getPrevious());
            pointer.getPrevious().setNext(pointer.getNext());
            pointer=pointer.getNext();
        }
        if (queue) {//now with bonus optional queue implementation.
            if (isEmpty()) throw new EmptyStackException();
            temp=(char)pointer.getPrevious().getDatum();
            if (pointer.getPrevious()==pointer) {
                pointer=null;
                return temp;
            }
            pointer.setPrevious(pointer.getPrevious().getPrevious());
            pointer.getPrevious().setNext(pointer);
        }
        return temp;
    }