code: private List<Group> populateList(final int numStdDev, final int limit) {
      final List<Group> list = new ArrayList<>();
      for (int i = 0; i < mapArrSize; i++) {
        if (hashArr[i] != 0) {
          final String priKey = priKeyArr[i];
          final int count = counterArr[i];
          final double est = sketch.getEstimate(count);
          final double ub = sketch.getUpperBound(numStdDev, count);
          final double lb = sketch.getLowerBound(numStdDev, count);
          final double thresh = (double) count / sketch.getRetainedEntries();
          final double rse = (sketch.getUpperBound(1, count) / est) - 1.0;
          final Group gp = group.copy();
          gp.init(priKey, count, est, ub, lb, thresh, rse);
          list.add(gp);
        }
      }
      list.sort(null); //Comparable implemented in Group
      final int totLen = list.size();
  
      final List<Group> returnList;
      if ((limit > 0) && (limit < totLen)) {
        returnList = list.subList(0, limit);
      } else {
        returnList = list;
      }
      return returnList;
    }
docs: Create the list of groups along with the error statistics
  @param numStdDev number of standard deviations
  @param limit the maximum size of the list to return
  @return the list of groups along with the error statistics