private void consumeReceivedVersions() {
    // Iterate in forward order
    for (Iterator<Long> it = received.iterator(); it.hasNext();) {
      long v = it.next();
      if (v <= previousVersion + 1) {
        // if the received version is less than the previous + 1, remove it.
        it.remove();
        if (v == previousVersion + 1) {
          // if the received version is equal to previous +1, also update the previous
          previousVersion = v;
        }
      } else {
        // Once we reach received entries greater than the previous, stop.
        break;
      }
    }

    // Iterate in reverse order
    for (Iterator<Long> it = received.descendingIterator(); it.hasNext();) {
      long v = it.next();
      if (v >= nextVersion - 1) {
        // if the received version is greater than the next - 1, remove it.
        it.remove();
        if (v == nextVersion - 1) {
          // if the received version is equal the next - 1, also update next.
          nextVersion = v;
        }
      } else {
        break;
      }
    }
  }
checks to see if any of the received versions can be merged into the start/end version numbers
geode-core/src/main/java/org/apache/geode/internal/cache/versions/RVVExceptionT.java