@Test(expected = NumberFormatException.class) public void testFromInvalidString() { Version.from("1.2.abcd.2"); }
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);  }