public RegionCommitList trim(RegionCommit rc) {
      if (get(size() - 1) != rc) {
        // no need to trim because it does not contain rc
        return this;
      }
      if (trimRC == rc) {
        return trimChild;
      }
      RegionCommitList result = new RegionCommitList(this);
      trimRC = rc;
      trimChild = result;
      result.remove(result.size() - 1);
      {
        for (final RegionCommit itrc : result) {
          itrc.incRefCount();
          if (itrc.needsAck()) {
            result.needsAck = true;
          }
        }
      }
      return result;
    }
Creates a new list, if needed, that contains all the elements of the specified old list
except the last one if it is 'rc'. Also recomputes needsAck field.
geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java