Examples: IsSorted property (DocumentCollection - Java)

This agent demonstrates a function that determines whether a document collection is sorted.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      DocumentCollection dc = db.getAllDocuments();
      printIsSorted(dc);
      dc.FTSearch("blue");
      printIsSorted(dc);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
  void printIsSorted(DocumentCollection dc) {
    try {
      if (dc.isSorted())
        System.out.println("Is sorted");
      else
        System.out.println("Is not sorted");
    
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}