code: private SortedMap<Object, ResetableIterator> regroup(Object key,
                                                         Iterator arg1, Reporter reporter) throws IOException {
      this.numOfValues = 0;
      SortedMap<Object, ResetableIterator> retv = new TreeMap<Object, ResetableIterator>();
      TaggedMapOutput aRecord = null;
      while (arg1.hasNext()) {
        this.numOfValues += 1;
        if (this.numOfValues % 100 == 0) {
          reporter.setStatus("key: " + key.toString() + " numOfValues: "
                             + this.numOfValues);
        }
        if (this.numOfValues > this.maxNumOfValuesPerGroup) {
          continue;
        }
        aRecord = ((TaggedMapOutput) arg1.next()).clone(job);
        Text tag = aRecord.getTag();
        ResetableIterator data = retv.get(tag);
        if (data == null) {
          data = createResetableIterator();
          retv.put(tag, data);
        }
        data.add(aRecord);
      }
      if (this.numOfValues > this.largestNumOfValues) {
        this.largestNumOfValues = numOfValues;
        LOG.info("key: " + key.toString() + " this.largestNumOfValues: "
                 + this.largestNumOfValues);
      }
      return retv;
    }
docs: This is the function that re-groups values for a key into sub-groups based
  on a secondary key (input tag).
  
  @param arg1
  @return