code: public boolean forEachPartition(IterateProcedure<E> p) {
          int curIdx = index.get(values.get(0).id());
          int from;
          int to;
          for (from = 0, to = 0; to < values.size(); to++) {
              int cIdx = index.get(values.get(to).id());
              if (curIdx != cIdx) {
                  if (!p.extract(this, curIdx, from, to)) {
                      return false;
                  }
                  from = to;
                  curIdx = cIdx;
              }
          }
          return p.extract(this, curIdx, from, to);
      }
docs: Execute a procedure on each partition.
  The partition is indicated by its bounds on the backend array.
  
  @param p the procedure to execute