class PDOutlineItemIterator implements Iterator<PDOutlineItem>
{
    private PDOutlineItem currentItem;
    private final PDOutlineItem startingItem;

    PDOutlineItemIterator(PDOutlineItem startingItem)
    {
        this.startingItem = startingItem;
    }

    @Override
    public boolean hasNext()
    {
        if (startingItem == null)
        {
            return false;
        }
        if (currentItem == null)
        {
            return true;
        }
        PDOutlineItem sibling = currentItem.getNextSibling();
        return sibling != null && !startingItem.equals(sibling);
    }

    @Override
    public PDOutlineItem next()
    {<FILL_FUNCTION_BODY>}

    @Override
    public void remove()
    {
        throw new UnsupportedOperationException();
    }
}

        if (!hasNext())
        {
            throw new NoSuchElementException();
        }
        if (currentItem == null)
        {
            currentItem = startingItem;
        }
        else
        {
            currentItem = currentItem.getNextSibling();
        }
        return currentItem;
    
<no_super_class>