getPrevDocument (DocumentCollection - Java)

Gets the document immediately preceding the current document or a specified document in a collection.

Defined in

DocumentCollection

Syntax

public Document getPrevDocument()
    throws NotesException
public Document getPrevDocument(Document doc)
    throws NotesException

Parameters

Document doc

Any document in the collection. Cannot be null.

Return value

Document

If no parameter, the document preceding the current document. If a parameter, the document preceding the specified document. If there is no previous document, returns null.

Usage

In remote (IIOP) operations, getPrevDocument(Document doc) invalidates the cache and is therefore discouraged.

The preferred loop structure is getLastDocument() followed by getPrevDocument() until it returns null. For performance reasons, you should avoid using getNthDocument(int n) in a loop.

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

Example