@Test public void testCompareVersionEquals() throws Exception { { Version version1 = new Version("27.0.0"); Version version2 = new Version("27.0.0"); Assert.assertTrue(version1.compareTo(version2) == 0); } { Version version1 = new Version("27.0"); Version version2 = new Version("27.0.0"); Assert.assertTrue(version1.compareTo(version2) == 0); } { Version version1 = new Version("27"); Version version2 = new Version("27.0.0"); Assert.assertTrue(version1.compareTo(version2) == 0); } { Version version1 = new Version("27"); Version version2 = new Version("27.0"); Assert.assertTrue(version1.compareTo(version2) == 0); } { Version version1 = new Version("27.0"); Version version2 = new Version("27.0.0"); Assert.assertTrue(version1.compareTo(version2) == 0); } }
public int compareTo(Version o) { return items.compareTo(o.items); }
Version implements Comparable<Version> { public int compareTo(Version o) { return items.compareTo(o.items); } }
Version implements Comparable<Version> { public int compareTo(Version o) { return items.compareTo(o.items); } Version(String version); }
Version implements Comparable<Version> { public int compareTo(Version o) { return items.compareTo(o.items); } Version(String version); boolean satisfies(String expr); int compareTo(Version o); String toString(); boolean equals(Object o); int hashCode(); boolean greaterThan(Version other); boolean greaterThanOrEqualTo(Version other); boolean lessThan(Version other); boolean lessThanOrEqualTo(Version other); }
Version implements Comparable<Version> { public int compareTo(Version o) { return items.compareTo(o.items); } Version(String version); boolean satisfies(String expr); int compareTo(Version o); String toString(); boolean equals(Object o); int hashCode(); boolean greaterThan(Version other); boolean greaterThanOrEqualTo(Version other); boolean lessThan(Version other); boolean lessThanOrEqualTo(Version other);  }