@Override
    public Iterator<E> iterator() {
        return new Iterator<E>() {
            private int current = size() - 1;
            private Node<E> tempFirst = first;

            @Override
            public boolean hasNext() {
                return current >= 0;
            }

            @Override
            public E next() {
                if (!hasNext()) {
                    return null;
                }
                E element = tempFirst.getElement();
                tempFirst = tempFirst.getNext();
                if (tempFirst != null)
                    tempFirst.setPrevious(null);
                current--;
                return element;
            }

            @Override
            public void remove() {
                if (hasNext()) {
                    dequeue();
                    current--;
                }
            }
        };
    }