code: protected void addIndexContents(Collection<PackageDoc> packages, String text,
              String tableSummary, Content body) {
          if (!packages.isEmpty()) {
              HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
                      ? HtmlTree.NAV()
                      : new HtmlTree(HtmlTag.DIV);
              htmlTree.addStyle(HtmlStyle.indexNav);
              HtmlTree ul = new HtmlTree(HtmlTag.UL);
              addAllClassesLink(ul);
              htmlTree.addContent(ul);
              body.addContent(htmlTree);
              addPackagesList(packages, text, tableSummary, body);
          }
      }
docs: Adds package index contents. Call appropriate methods from
  the sub-classes. Adds it to the body HtmlTree
  
  @param packages a collection of packages 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