/** * Compare both versions. * * @param other * Version to be compared to * @param Flag * which indicates whether the snapshot flag should be compared as well. * * @return 0, if same versions. Greater 0 if other is older. Otherwise -1 */ public int compareTo(MavenVersionNumber other, boolean checkSnapshot) { if (other == null) { return 1; } int diff = major - other.major; if (diff == 0) { diff = minor - other.minor; } if (diff == 0) { diff = patch - other.patch; } if (diff == 0 && checkSnapshot) { diff = getSnapshotValue() - other.getSnapshotValue(); } return diff; }