public E dequeue() {
        if (size() == 0)
            return null;

        Node<E> tempNode = first;
        first = first.getNext();
        if (first != null)
            first.setPrevious(null);
        else
            last = null;
        size--;
        return tempNode.getElement();
    }