getNthDocument (DocumentCollection - Java)

Given a position number, returns the document at that position in a collection.

Defined in

DocumentCollection

Syntax

public Document getNthDocument(int n)
    throws NotesException

Parameters

int n

Integer. A number indicating the document to return. Use 1 to indicate the first document in the collection, 2 to indicate the second document, and so on.

Return value

Document

The document in the nth position in the collection. If there is no document at the specified position, returns null.

Usage

Collections are renumbered when deletions occur so that the positions of documents after the deleted document change.

Using getNthDocument in conjunction with getCount to iterate through a loop is strongly discouraged for performance reasons. See getNextDocument and getPrevDocument for the preferred loop structures.

Example