public int compareTo()

in custom/src/main/java/co/elastic/otel/common/util/Version.java [76:92]


  public int compareTo(Version another) {
    final int maxLength = Math.max(numbers.length, another.numbers.length);
    for (int i = 0; i < maxLength; i++) {
      final int left = i < numbers.length ? numbers[i] : 0;
      final int right = i < another.numbers.length ? another.numbers[i] : 0;
      if (left != right) {
        return left < right ? -1 : 1;
      }
    }
    if (suffix.isEmpty() || another.suffix.isEmpty()) {
      // no suffix is greater than any suffix (1.0.0 > 1.0.0-SNAPSHOT)
      return another.suffix.compareTo(suffix);
    } else {
      // if both have a suffix, sort in natural order (1.0.0-RC2 > 1.0.0-RC1)
      return suffix.compareTo(another.suffix);
    }
  }