code: protected void addIndexContents(Collection<ModuleElement> modules, String text,
              String tableSummary, Content body) {
          HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
                  ? HtmlTree.NAV()
                  : new HtmlTree(HtmlTag.DIV);
          htmlTree.addStyle(HtmlStyle.indexNav);
          HtmlTree ul = new HtmlTree(HtmlTag.UL);
          addAllClassesLink(ul);
          addAllPackagesLink(ul);
          htmlTree.addContent(ul);
          body.addContent(htmlTree);
          addModulesList(modules, text, tableSummary, body);
      }
docs: Adds module index contents. Call appropriate methods from
  the sub-classes. Adds it to the body HtmlTree
  
  @param modules the modules to be documented
  @param text string which will be used as the heading
  @param tableSummary summary for the table
  @param body the document tree to which the index contents will be added