@Test public void equalsAndHashcode() { Path a1 = Paths.of("a", "b", "c/"); Path a2 = Paths.of("/a/", "/b/", "/c/"); Path a3 = Paths.of("/a", "b", "c", ""); assertEquals(a1, a2); assertEquals(a2, a3); assertEquals(a1, a3); assertEquals(a1.hashCode(), a2.hashCode()); assertEquals(a2.hashCode(), a3.hashCode()); assertEquals(a1.hashCode(), a3.hashCode()); Path b1 = Paths.of("a"); assertNotEquals(a1, b1); assertNotEquals(a2, b1); assertNotEquals(a3, b1); assertNotEquals(a1.hashCode(), b1.hashCode()); assertNotEquals(a2.hashCode(), b1.hashCode()); assertNotEquals(a3.hashCode(), b1.hashCode()); }
public static Path of(String... segments) { if (segments.length == 0) { return ImmutablePath.EMPTY; } PathBuilder pathBuilder = new PathBuilder(); for (String segment : segments) { pathBuilder.splitAndAdd(segment, false); } return ImmutablePath.create(pathBuilder); }
Paths { public static Path of(String... segments) { if (segments.length == 0) { return ImmutablePath.EMPTY; } PathBuilder pathBuilder = new PathBuilder(); for (String segment : segments) { pathBuilder.splitAndAdd(segment, false); } return ImmutablePath.create(pathBuilder); } }
Paths { public static Path of(String... segments) { if (segments.length == 0) { return ImmutablePath.EMPTY; } PathBuilder pathBuilder = new PathBuilder(); for (String segment : segments) { pathBuilder.splitAndAdd(segment, false); } return ImmutablePath.create(pathBuilder); }  }
Paths { public static Path of(String... segments) { if (segments.length == 0) { return ImmutablePath.EMPTY; } PathBuilder pathBuilder = new PathBuilder(); for (String segment : segments) { pathBuilder.splitAndAdd(segment, false); } return ImmutablePath.create(pathBuilder); }  static Path of(String... segments); static Path parse(String path); static Path empty(); }
Paths { public static Path of(String... segments) { if (segments.length == 0) { return ImmutablePath.EMPTY; } PathBuilder pathBuilder = new PathBuilder(); for (String segment : segments) { pathBuilder.splitAndAdd(segment, false); } return ImmutablePath.create(pathBuilder); }  static Path of(String... segments); static Path parse(String path); static Path empty();  }