ImmutableListPathCore implements PathCore<ImmutableListPathCore> { @Override public boolean endsWith(ImmutableListPathCore other) { if (other.isAbsolute()) { return isAbsolute() && this.equals(other); } else if (other.path.size() > path.size()) { return false; } else { int start = path.size() - other.path.size(); return other.path.equals(path.subList(start, path.size())); } } ImmutableListPathCore(@Nullable String root, Iterable<String> path); static Parser parser(String separator); static Parser namedRootParser(String separator, NamedRootFormat format, String rootId); @Override boolean isAbsolute(); @Override ImmutableListPathCore getRoot(); @Override ImmutableListPathCore getFileName(); @Override ImmutableListPathCore getParent(); @Override int getNameCount(); @Override ImmutableListPathCore getName(int index); @Override ImmutableListPathCore subpath(int beginIndex, int endIndex); @Override boolean startsWith(ImmutableListPathCore other); @Override boolean endsWith(ImmutableListPathCore other); @Override ImmutableListPathCore normalize(); @Override ImmutableListPathCore resolve(ImmutableListPathCore other); @Override ImmutableListPathCore resolveSibling(ImmutableListPathCore other); @Override ImmutableListPathCore relativize(ImmutableListPathCore other); @Override String toPathString(String separator); @Override String toString(); @Override int compareTo(ImmutableListPathCore other); @Override boolean equals(Object obj); @Override int hashCode(); @Nullable String getRootString(); ImmutableList<String> getPathSegments();  }
@Test public void pathEndsWithItself() { assertThat(relative, endsWith(relative)); assertThat(absolute, endsWith(absolute)); }
@Test public void relativeEndsWithRelative() { ImmutableListPathCore test = core(null, "to", "file"); assertThat(relative, endsWith(test)); }
@Test public void absoluteEndsWithRelative() { ImmutableListPathCore test = core(null, "to", "file"); assertThat(absolute, endsWith(test)); }