I'm not sure as to how I'd go about comparing two version strings, and include support for "SNAPSHOT" in the version name.
An example: I have two version strings, "1.9.9" and "2.0.0". I want to return a boolean (true) if the second string is greater than the first string. I've used this: https://stackoverflow.com/a/6702029/1442718
It works perfectly.
However, an example like this won't work with that code: I have two version strings, "2.0.0-SNAPSHOT" and "2.0.0". Obviously the SNAPSHOT is one version behind 2.0.0, but this method won't pick it up and throw a NumberFormatException, instead of returning -1 which implies it is a version below.
Any suggestions? Thanks.