public int compareTo(AppVersion other){
  int result=major - other.major;
  if (result == 0) {
    result=minor - other.minor;
  }
  if (result == 0) {
    result=patch - other.patch;
  }
  if (result == 0 && (milestone > -1 || other.milestone > -1)) {
    if (milestone > -1) {
      if (other.milestone == -1) {
        result=-1;
      }
 else {
        result=milestone - other.milestone;
      }
    }
 else {
      if (other.milestone > -1) {
        result=1;
      }
    }
  }
  if (result == 0 && !ObjectUtil.nullEquals(modifier,other.modifier)) {
    if (modifier == null) {
      result=1;
    }
 else     if (other.modifier == null) {
      result=-1;
    }
 else {
      result=modifier.compareToIgnoreCase(other.modifier);
    }
  }
  return result;
}

public int compareTo ( AppVersion other ) { int result = major - other . major ; if ( result == 0 ) { result = minor - other . minor ; } if ( result == 0 ) { result = patch - other . patch ; } if ( result == 0 && ( milestone > - 1 || other . milestone > - 1 ) ) { if ( milestone > - 1 ) { if ( other . milestone == - 1 ) { result = - 1 ; } else { result = milestone - other . milestone ; } } else { if ( other . milestone > - 1 ) { result = 1 ; } } } if ( result == 0 && ! ObjectUtil . nullEquals ( modifier , other . modifier ) ) { if ( modifier == null ) { result = 1 ; } else if ( other . modifier == null ) { result = - 1 ; } else { result = modifier . compareToIgnoreCase ( other . modifier ) ; } } return result ; }
compares two version numbers according to their major , minor , patch and milestone version numbers , ordering from oldest to newest version . if all version numbers are equal then their modifiers are compared lexicographically ( based on the unicode value of each character ) , ignoring case . versions without a modifier or milestone are considered to be the " final " versions and come after otherwise equal versions with a modifier or milestone .
