code: public Comparator<Doc> makeComparatorForIndexUse() {
          return new Utils.DocComparator<Doc>() {
              /**
               * Compare two given Doc entities, first sort on names, then on the kinds,
               * then on the parameters only if the type is an instance of ExecutableMemberDocs,
               * the parameters are compared and finally the fully qualified names.
               *
               * @param d1 - a Doc element.
               * @param d2 - a Doc element.
               * @return a negative integer, zero, or a positive integer as the first
               *         argument is less than, equal to, or greater than the second.
               */
              public int compare(Doc d1, Doc d2) {
                  int result = compareNames(d1, d2);
                  if (result != 0) {
                      return result;
                  }
                  result = compareDocKinds(d1, d2);
                  if (result != 0) {
                      return result;
                  }
                  if (hasParameters(d1)) {
                      Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
                      Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
                      result = compareParameters(false, param1, param2);
                      if (result != 0) {
                          return result;
                      }
                      result = compareParameters(true, param1, param2);
                      if (result != 0) {
                          return result;
                      }
                  }
                  return compareFullyQualifiedNames(d1, d2);
              }
          };
      }
docs: A comparator for index file presentations, and are sorted as follows:
  1. sort on simple names of entities
  2. if equal, then compare the DocKind ex: Package, Interface etc.
  3a. if equal and if the type is of ExecutableMemberDoc(Constructor, Methods),
  a case insensitive comparison of parameter the type signatures
  3b. if equal, case sensitive comparison of the type signatures
  4. finally, if equal, compare the FQNs of the entities
  @return a comparator for index file use