@Override
  public Iterator<T> iterator() {
    return new Iterator<T>() {
      private Node<T> cursor = getFirstNode();
      private T lastReturn;

      @Override
      public boolean hasNext() {
        return cursor != null;
      }

      @Override
      public T next() {
        if (cursor == null) {
          throw new NoSuchElementException();
        }
        lastReturn = cursor.getValue();
        cursor = getSuccessor(cursor);
        return lastReturn;
      }

      @Override
      public void remove() {
        if (lastReturn == null) {
          throw new NoSuchElementException();
        }
        T currentValue = cursor == null ? null : cursor.getValue();
        delete(lastReturn);
        cursor = currentValue == null ? null : getNode(currentValue);
        lastReturn = null;
      }
    };
  }