next

next(value: Any output): Boolean;

The next method of the SetMergeIterator class accesses successive entries in the sets comprising the merged iterator view.

This method returns true when a next entry is found, and the entry is assigned to the value parameter. It returns false when a next entry is not found because the iterator is positioned after the last entry in the merged view, and the value parameter becomes a null reference.

When the next method is used with an iterator where that iterator has been passed to a method as a method parameter, the iterator must be defined as a usage input; that is, the iterator cannot be modified by the called method.

The following example shows the use of the next method.

getPosition(pObj: Object; pIter: SetMergeIterator input): Integer;
vars
    pos : Integer;
    obj : Object;
begin
    while pIter.next(obj) do
        pos := pos + 1;
        if obj = pObj then
            return pos;
        endif;
    endwhile;
    return 0;
end;