@Test public void parent() { Assert.assertEquals(new Path("/a/b/c").getParent(), new Path("/a/b/")); Assert.assertEquals(new Path("/a/b/c").getParent().getParent(), new Path("/a/")); Assert.assertEquals(new Path("/a/b/c").getParent().getParent().getParent(), new Path("/")); Assert.assertNull(new Path("/a/b/c").getParent().getParent().getParent().getParent()); }
public Path getParent() { if (this.isEmpty()) { return null; } else { return new Path(pieces, start, end - 1); } }
Path implements Iterable<ChildKey>, Comparable<Path> { public Path getParent() { if (this.isEmpty()) { return null; } else { return new Path(pieces, start, end - 1); } } }
Path implements Iterable<ChildKey>, Comparable<Path> { public Path getParent() { if (this.isEmpty()) { return null; } else { return new Path(pieces, start, end - 1); } } Path(ChildKey... segments);  Path(List<String> segments);  Path(String pathString); private  Path(ChildKey[] pieces, int start, int end); }
Path implements Iterable<ChildKey>, Comparable<Path> { public Path getParent() { if (this.isEmpty()) { return null; } else { return new Path(pieces, start, end - 1); } } Path(ChildKey... segments);  Path(List<String> segments);  Path(String pathString); private  Path(ChildKey[] pieces, int start, int end); static Path getRelative(Path from, Path to); static Path getEmptyPath(); Path child(Path path); Path child(ChildKey child); @Override String toString(); String wireFormat(); List<String> asList(); ChildKey getFront(); Path popFront(); Path getParent(); ChildKey getBack(); boolean isEmpty(); int size(); @Override Iterator<ChildKey> iterator(); boolean contains(Path other); @Override boolean equals(Object other); @Override int hashCode(); @Override int compareTo(Path other); }
Path implements Iterable<ChildKey>, Comparable<Path> { public Path getParent() { if (this.isEmpty()) { return null; } else { return new Path(pieces, start, end - 1); } } Path(ChildKey... segments);  Path(List<String> segments);  Path(String pathString); private  Path(ChildKey[] pieces, int start, int end); static Path getRelative(Path from, Path to); static Path getEmptyPath(); Path child(Path path); Path child(ChildKey child); @Override String toString(); String wireFormat(); List<String> asList(); ChildKey getFront(); Path popFront(); Path getParent(); ChildKey getBack(); boolean isEmpty(); int size(); @Override Iterator<ChildKey> iterator(); boolean contains(Path other); @Override boolean equals(Object other); @Override int hashCode(); @Override int compareTo(Path other);  }