code: @Override
    public int compareTo(CloudSdkVersion other) {
      Preconditions.checkNotNull(other);
  
      if ("HEAD".equals(version) && !"HEAD".equals(other.version)) {
        return 1;
      } else if (!"HEAD".equals(version) && "HEAD".equals(other.version)) {
        return -1;
      }
  
      // First, compare required fields
      List<Integer> mine = ImmutableList.of(majorVersion, minorVersion, patchVersion);
      List<Integer> others =
          ImmutableList.of(other.majorVersion, other.minorVersion, other.patchVersion);
      for (int i = 0; i < mine.size(); i++) {
        int result = mine.get(i).compareTo(others.get(i));
        if (result != 0) {
          return result;
        }
      }
  
      // Compare pre-release components
      if (preRelease != null && other.getPreRelease() != null) {
        return preRelease.compareTo(other.getPreRelease());
      }
  
      // A SemVer with a pre-release string has lower precedence than one without.
      if (preRelease == null && other.getPreRelease() != null) {
        return 1;
      }
      if (preRelease != null && other.getPreRelease() == null) {
        return -1;
      }
  
      return 0;
    }
docs: Compares this to another CloudSdkVersion, per the Semantic Versioning 2.0.0 specification.
  
  <p>Note that the build identifier field is excluded for comparison. Thus, <code>
  new CloudSdkVersion("0.0.1+v1").compareTo(new CloudSdkVersion("0.0.1+v2")) == 0</code>