@Test public void testFromString() { Assert.assertEquals(new Version(1, 2, 1), Version.from("1.2. 1 ")); Assert.assertEquals(new Version(3, 2, 6), Version.from(" 3. 2.6")); Assert.assertEquals(new Version(100, 200, 104), Version.from("100. 200. 104")); Assert.assertEquals(new Version(1), Version.from(" 1 ")); }
public static Version from(String string) throws NumberFormatException { return new Version( Stream.of(string.trim().split("\\.")) .map(String::trim) .map(Integer::parseInt) .toArray(Integer[]::new) ); }
Version implements Comparable<Version> { public static Version from(String string) throws NumberFormatException { return new Version( Stream.of(string.trim().split("\\.")) .map(String::trim) .map(Integer::parseInt) .toArray(Integer[]::new) ); } }
Version implements Comparable<Version> { public static Version from(String string) throws NumberFormatException { return new Version( Stream.of(string.trim().split("\\.")) .map(String::trim) .map(Integer::parseInt) .toArray(Integer[]::new) ); } Version(Integer... parts); }
Version implements Comparable<Version> { public static Version from(String string) throws NumberFormatException { return new Version( Stream.of(string.trim().split("\\.")) .map(String::trim) .map(Integer::parseInt) .toArray(Integer[]::new) ); } Version(Integer... parts); static Version from(String string); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Version o); }
Version implements Comparable<Version> { public static Version from(String string) throws NumberFormatException { return new Version( Stream.of(string.trim().split("\\.")) .map(String::trim) .map(Integer::parseInt) .toArray(Integer[]::new) ); } Version(Integer... parts); static Version from(String string); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Version o);  }