Examples: getPrevSibling method (ViewNavigator - Java)

This agent gets all the top-level entries from last to first.

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();
      View view = db.getView("By Category");
      view.setAutoUpdate(false);
      ViewNavigator nav = view.createViewNav();
      ViewEntry tmpentry;
      ViewEntry entry = nav.getLast();
      int n = 0;
      do { entry = nav.getCurrent(); }
        while (nav.gotoParent());
      while (entry != null) {
        System.out.println("Last category minus " + n + " 
        has " +
        entry.getDescendantCount() + " descendants");
        n++;
        tmpentry = nav.getPrevSibling(); 
        entry.recycle();
        entry = tmpentry;
      }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}