final public int compareTo()

in intellij-plugin-structure/structure-intellij/src/main/java/com/jetbrains/plugin/structure/intellij/version/IdeVersion.java [130:158]


  final public int compareTo(@NotNull IdeVersion other) {
    String thisCode = getProductCode();
    String otherCode = other.getProductCode();

    int compareProductCodes = thisCode.compareTo(otherCode);
    if (!thisCode.isEmpty() && !otherCode.isEmpty() && compareProductCodes != 0) {
      return compareProductCodes;
    }

    int[] c1 = getComponents();
    int[] c2 = other.getComponents();

    for (int i = 0; i < Math.min(c1.length, c2.length); i++) {
      if (c1[i] == c2[i] && c1[i] == Integer.MAX_VALUE) {
        return 0;
      }
      if (c1[i] == Integer.MAX_VALUE) {
        return 1;
      }
      if (c2[i] == Integer.MAX_VALUE) {
        return -1;
      }
      int result = Integer.compare(c1[i], c2[i]);
      if (result != 0) {
        return result;
      }
    }
    return Integer.compare(c1.length, c2.length);
  }