code: @Override
    public int compareTo(CloudSdkVersionPreRelease other) {
      Preconditions.checkNotNull(other);
  
      // Compare segments from left to right. A smaller number of pre-release segments comes before a
      // higher number, if all preceding segments are equal.
      int index = 0;
      while (index < this.segments.size() && index < other.segments.size()) {
        int result = this.segments.get(index).compareTo(other.segments.get(index));
        if (result != 0) {
          return result;
        }
        index++;
      }
  
      // If we've reached this point, the smaller list comes first.
      if (this.segments.size() < other.segments.size()) {
        return -1;
      } else if (this.segments.size() > other.segments.size()) {
        return 1;
      }
      return 0;
    }
docs: Compares this to another CloudSdkVersionPreRelease.
  
  <p>Precedence for two pre-release versions MUST be determined by comparing each dot separated
  identifier from left to right until a difference is found as follows: identifiers consisting of
  only digits are compared numerically and identifiers with letters or hyphens are compared
  lexically in ASCII sort order. Numeric identifiers always have lower precedence than
  non-numeric identifiers.