@Test public void testGetContainer() { final PathContainerService s = new PathContainerService(); assertEquals("/t", s.getContainer(new Path("/t", EnumSet.of(Path.Type.directory))).getAbsolute()); final Path root = new Path("/", EnumSet.of(Path.Type.directory)); assertSame(root, s.getContainer(root)); }
public Path getContainer(final Path file) { if(file.isRoot()) { return file; } Path container = file; while(!this.isContainer(container)) { container = container.getParent(); } return container; }
PathContainerService { public Path getContainer(final Path file) { if(file.isRoot()) { return file; } Path container = file; while(!this.isContainer(container)) { container = container.getParent(); } return container; } }
PathContainerService { public Path getContainer(final Path file) { if(file.isRoot()) { return file; } Path container = file; while(!this.isContainer(container)) { container = container.getParent(); } return container; }  }
PathContainerService { public Path getContainer(final Path file) { if(file.isRoot()) { return file; } Path container = file; while(!this.isContainer(container)) { container = container.getParent(); } return container; }  Path getRoot(final Path file); boolean isContainer(final Path file); Path getContainer(final Path file); String getKey(final Path file); }
PathContainerService { public Path getContainer(final Path file) { if(file.isRoot()) { return file; } Path container = file; while(!this.isContainer(container)) { container = container.getParent(); } return container; }  Path getRoot(final Path file); boolean isContainer(final Path file); Path getContainer(final Path file); String getKey(final Path file);  }