@Test public void nothingEndsWithAnAbsolutePath() { assertFalse(path("/path").endsWith("/path")); }
@Override public boolean endsWith(Path other) { if (other.isAbsolute()) { return false; } int otherNameCount = other.getNameCount(); if (otherNameCount > getNameCount()) { return false; } for (int i = 0; i < otherNameCount; i++) { String otherName = other.getName(otherNameCount - i - 1).toString(); String ownName = getName(getNameCount() - i - 1).toString(); if (!ownName.equals(otherName)) { return false; } } return true; }
BoxPath implements Path { @Override public boolean endsWith(Path other) { if (other.isAbsolute()) { return false; } int otherNameCount = other.getNameCount(); if (otherNameCount > getNameCount()) { return false; } for (int i = 0; i < otherNameCount; i++) { String otherName = other.getName(otherNameCount - i - 1).toString(); String ownName = getName(getNameCount() - i - 1).toString(); if (!ownName.equals(otherName)) { return false; } } return true; } }
BoxPath implements Path { @Override public boolean endsWith(Path other) { if (other.isAbsolute()) { return false; } int otherNameCount = other.getNameCount(); if (otherNameCount > getNameCount()) { return false; } for (int i = 0; i < otherNameCount; i++) { String otherName = other.getName(otherNameCount - i - 1).toString(); String ownName = getName(getNameCount() - i - 1).toString(); if (!ownName.equals(otherName)) { return false; } } return true; } BoxPath(BoxFileSystem fileSystem, String path); }
BoxPath implements Path { @Override public boolean endsWith(Path other) { if (other.isAbsolute()) { return false; } int otherNameCount = other.getNameCount(); if (otherNameCount > getNameCount()) { return false; } for (int i = 0; i < otherNameCount; i++) { String otherName = other.getName(otherNameCount - i - 1).toString(); String ownName = getName(getNameCount() - i - 1).toString(); if (!ownName.equals(otherName)) { return false; } } return true; } BoxPath(BoxFileSystem fileSystem, String path); FolderLike toFilderLike(); @Override FileSystem getFileSystem(); @Override boolean isAbsolute(); @Override BoxPath getRoot(); @Override Path getFileName(); @Override BoxPath getParent(); @Override int getNameCount(); @Override BoxPath getName(int index); @Override BoxPath subpath(int beginIndex, int endIndex); @Override boolean startsWith(Path other); @Override boolean startsWith(String other); @Override boolean endsWith(Path other); @Override boolean endsWith(String other); @Override BoxPath normalize(); @Override BoxPath resolve(Path other); @Override BoxPath resolve(String other); @Override BoxPath resolveSibling(Path other); @Override BoxPath resolveSibling(String other); @Override BoxPath relativize(Path other); @Override URI toUri(); @Override BoxPath toAbsolutePath(); @Override BoxPath toRealPath(LinkOption... options); @Override File toFile(); @Override WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers); @Override WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events); @Override Iterator<Path> iterator(); @Override int compareTo(Path other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
BoxPath implements Path { @Override public boolean endsWith(Path other) { if (other.isAbsolute()) { return false; } int otherNameCount = other.getNameCount(); if (otherNameCount > getNameCount()) { return false; } for (int i = 0; i < otherNameCount; i++) { String otherName = other.getName(otherNameCount - i - 1).toString(); String ownName = getName(getNameCount() - i - 1).toString(); if (!ownName.equals(otherName)) { return false; } } return true; } BoxPath(BoxFileSystem fileSystem, String path); FolderLike toFilderLike(); @Override FileSystem getFileSystem(); @Override boolean isAbsolute(); @Override BoxPath getRoot(); @Override Path getFileName(); @Override BoxPath getParent(); @Override int getNameCount(); @Override BoxPath getName(int index); @Override BoxPath subpath(int beginIndex, int endIndex); @Override boolean startsWith(Path other); @Override boolean startsWith(String other); @Override boolean endsWith(Path other); @Override boolean endsWith(String other); @Override BoxPath normalize(); @Override BoxPath resolve(Path other); @Override BoxPath resolve(String other); @Override BoxPath resolveSibling(Path other); @Override BoxPath resolveSibling(String other); @Override BoxPath relativize(Path other); @Override URI toUri(); @Override BoxPath toAbsolutePath(); @Override BoxPath toRealPath(LinkOption... options); @Override File toFile(); @Override WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers); @Override WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events); @Override Iterator<Path> iterator(); @Override int compareTo(Path other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }