getNextDocument (View - Java)

Given a document in a view, returns the document immediately following it.

Defined in

View

Syntax

public Document getNextDocument(Document doc)
    throws NotesException

Parameters

Document doc

Any document in the view. Cannot be null.

Return value

Document

The document in the view following the specified parameter. Returns null if there are no more documents in the view.

Usage

This method returns the next document in the view regardless of what type of document it is (document, response, or response-to-response). If you want the next sibling document in the view, use getNextSibling.

If the view is filtered by FTSearch, this method returns the next document in the filtered view.

The ViewNavigator and ViewEntryCollection classes provide more efficient methods for navigating views and accessing entries.

In loops you should recycle the Document object on each iteration. Use a temporary Document object to save and restore the object.

When processing documents in a loop, do not delete the document, or modify it in a way that causes it to disappear from the view or for its position to change. In that situation, GetNextDocument method may not return a useful result because the document that was the next document, is now at a different position in the view. The most common symptom of this problem is that documents are skipped when you loop through them.

To address this issue, change your logic so that you call GetNextDocument before making any change to the document. Or, use NotesView.AutoUpdate (= False) to prevent re-indexing of the view while you're using it.

Example