Path implements CacheValue, Comparable<Path> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj instanceof Path) { Path other = (Path) obj; return this.name.equals(other.name) && Objects.equals(this.parent, other.parent); } return false; } private  Path(@Nullable Path parent,
                 @NotNull String name,
                 int hash);  Path(@NotNull Path parent, @NotNull String name);  Path(@NotNull String name); @NotNull String getName(); @NotNull Iterable<String> elements(); boolean isRoot(); @Nullable Path getParent(); int length(); int getDepth(); @NotNull Path getAncestor(int nth); boolean isAncestorOf(@NotNull Path other); boolean isAbsolute(); @NotNull static Path fromString(@NotNull String path); @NotNull StringBuilder toStringBuilder(@NotNull StringBuilder sb); @Override int getMemory(); @Override int compareTo(@NotNull Path other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final Path ROOT; }
@Test public void equals() { assertEquals(ROOT, Path.fromString("/")); assertEquals(foo, Path.fromString("/foo")); assertEquals(fooBar, Path.fromString("/foo/bar")); assertEquals(relFoo, Path.fromString("foo")); assertEquals(relFooBar, Path.fromString("foo/bar")); assertNotEquals(fooBar, Path.fromString("foo/bar")); assertNotEquals(relFooBar, Path.fromString("/foo/bar")); }