@Test public void removeDotSegments() { assertEquals(Arrays.asList(), Paths.of(".").segments()); assertEquals(Arrays.asList(), Paths.of("..").segments()); assertEquals(Arrays.asList(), Paths.of("/parent/..").segments()); assertEquals(Arrays.asList("parent"), Paths.of("/parent/.").segments()); assertEquals(Arrays.asList("parent"), Paths.of("/parent/%2e").segments()); assertEquals(Arrays.asList("parent"), Paths.of("/parent/%2e/").segments()); assertEquals(Arrays.asList("parent", "dir"), Paths.of("/parent/%2e/dir").segments()); assertEquals(Arrays.asList("dir"), Paths.of("/parent/%2e%2E/dir").segments()); }
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();  }