public Object nextElement()
    {
        // d139782 Begins
        if (hasMoreElements()) {
            // d140126 Begins
            // some previous nextElement call detected that the server resources has
            //  been released, the last element was returned. Any subsequent call
            //  to nextElement will result with a CollectionCannotBeFurtherAccessedException.
            if (collectionExceptionPending)
            {
                throw new CollectionCannotBeFurtherAccessedException();
            }
            // d140126 Ends

            // extract the next element from the local wrapper collection.
            Object result = wrappers.elementAt(itrIndex++); // LIDB833.1
            // test if local index has advanced to exceed the max count.
            if (server == null ||
                (parentCollection != null &&
                ((FinderResultClientCollection) parentCollection).hasAllWrappers()))
            { // server == null indicates greedy collection and all wrapper is available.
              // in lazy collection and Collection interface, potentially there are other
              //  iterator concurrently updating the client wrapper cached in the Collection object
              //  this check is used to examine this iterator's parent Collection for short-cut wrapper
              //  retrieval.
                if (itrIndex >= wrappers.size()) { // LIDB833.1
                    exhausted = true;
                }
            } else
            { // if next element index is not in the client wrapper cache,
              //  need to find out from the remote server to satisfy the next hasMoreElement()
              //  call semantics.
                if (itrIndex >= wrappers.size()) { // LIDB833.1
                    try {
                        // go remote to get the next sub-collection of wrappers
                        Vector nextWrappers = server.getNextWrapperCollection(wrappers.size(),
                                                                              chunkSize);
                        if (nextWrappers == null || nextWrappers.size() == 0) {
                            // well, there are no more from remote
                            exhausted = true;
                            if (parentCollection != null)
                            { // need to inform parent Collection all wrappers has been retrieved from server.
                                ((FinderResultClientCollection) parentCollection).allWrappersCached();
                            }
                        } else { // LIDB833.1
                            // append the next set of wrappers to the parent's wrapper set
                            wrappers.addAll(nextWrappers); // LIDB833.1
                        }
                    } catch (RemoteException rex) {
                        collectionExceptionPending = true; // d140126
                        //                        throw new CollectionCannotBeFurtherAccessedException(); // LIDB833.1
                    }
                }
            }
            return (result);
        }
        // d139782 Ends
        throw new NoSuchElementException();
    }
public Object nextElement ( ) { if ( hasMoreElements ( ) ) { if ( collectionExceptionPending ) { throw new CollectionCannotBeFurtherAccessedException ( ) ; } Object result = wrappers . elementAt ( itrIndex ++ ) ; if ( server == null || ( parentCollection != null && ( ( FinderResultClientCollection ) parentCollection ) . hasAllWrappers ( ) ) ) { if ( itrIndex >= wrappers . size ( ) ) { exhausted = true ; } } else { if ( itrIndex >= wrappers . size ( ) ) { try { Vector nextWrappers = server . getNextWrapperCollection ( wrappers . size ( ) , chunkSize ) ; if ( nextWrappers == null || nextWrappers . size ( ) == 0 ) { exhausted = true ; if ( parentCollection != null ) { ( ( FinderResultClientCollection ) parentCollection ) . allWrappersCached ( ) ; } } else { wrappers . addAll ( nextWrappers ) ; } } catch ( RemoteException rex ) { collectionExceptionPending = true ; } } } return ( result ) ; } throw new NoSuchElementException ( ) ; }
Returns the next element in the iterator/enumeration. This will look ahead
at least one element to satisfy the hasMoreElement/nextElement semantics
without disrupting the datasource cursor.

@return the next element in the iteration.
@exception NoSuchElementException enumeration has no more elements.