Class Version

  • All Implemented Interfaces:
    java.lang.Comparable<Version>

    public class Version
    extends java.lang.Object
    implements java.lang.Comparable<Version>
    Comparable class which can compare version strings. Versions are of the form A.B[-C[x]], where the square bracketed parts are optional. A, B and C must be integers if present. x may be freeform.

    For comparison, only A, B and C parts are considered. If C is missing, it is considered equal to zero. For equality, the original version string is used.

    Note: this class has a natural ordering that is inconsistent with equals.

    Since:
    20 Dec 2010
    Author:
    Mark Taylor
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(Version other)
        Specified by:
        compareTo in interface java.lang.Comparable<Version>