@Test public void testEquals() { Path path = new Path("/a/b/c/d"); Path path2 = new Path("/a/b/c/d/"); Path path3 = new Path("/a/b/c Path path4 = new Path("/a/b/././c/./e/../d/"); assertEquals(path, path); assertEquals(path, path2); assertEquals(path, path3); assertEquals(path, path4); assertEquals(path.hashCode(), path2.hashCode()); assertEquals(path.hashCode(), path3.hashCode()); assertEquals(path.hashCode(), path4.hashCode()); assertFalse(path.equals(null)); assertFalse(path.equals(new Path("a/b/c/d"))); assertFalse(path.equals(new Path("/a/b/c/e"))); assertFalse(path.equals(new Path("/a/b/c/d/e"))); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Path)) { return false; } Path target = (Path) obj; if ((separators & HASH_MASK) != (target.separators & HASH_MASK)) { return false; } String[] targetSegments = target.segments; int i = segments.length; if (i != targetSegments.length) { return false; } while (--i >= 0) { if (!segments[i].equals(targetSegments[i])) { return false; } } return true; }
Path implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Path)) { return false; } Path target = (Path) obj; if ((separators & HASH_MASK) != (target.separators & HASH_MASK)) { return false; } String[] targetSegments = target.segments; int i = segments.length; if (i != targetSegments.length) { return false; } while (--i >= 0) { if (!segments[i].equals(targetSegments[i])) { return false; } } return true; } }
Path implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Path)) { return false; } Path target = (Path) obj; if ((separators & HASH_MASK) != (target.separators & HASH_MASK)) { return false; } String[] targetSegments = target.segments; int i = segments.length; if (i != targetSegments.length) { return false; } while (--i >= 0) { if (!segments[i].equals(targetSegments[i])) { return false; } } return true; } Path(String fullPath); private  Path(String[] segments, int separators); }
Path implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Path)) { return false; } Path target = (Path) obj; if ((separators & HASH_MASK) != (target.separators & HASH_MASK)) { return false; } String[] targetSegments = target.segments; int i = segments.length; if (i != targetSegments.length) { return false; } while (--i >= 0) { if (!segments[i].equals(targetSegments[i])) { return false; } } return true; } Path(String fullPath); private  Path(String[] segments, int separators); static Path createFromAbsolutePath(String path); static Path createFromSegments(String[] segments); Path addFileExtension(String extension); Path addTrailingSeparator(); Path append(Path tail); Path append(String tail); @Override boolean equals(Object obj); @Override int hashCode(); String getFileExtension(); boolean hasTrailingSeparator(); boolean isAbsolute(); boolean isEmpty(); boolean isPrefixOf(Path anotherPath); boolean isRoot(); static boolean isValidPath(String path); String lastSegment(); Path makeAbsolute(); Path makeRelative(); int matchingFirstSegments(Path anotherPath); Path removeFileExtension(); Path removeFirstSegments(int count); Path removeLastSegments(final int count); Path removeTrailingSeparator(); String segment(int index); int segmentCount(); String[] segments(); @Override String toString(); Path uptoSegment(final int count); static String getFileNameFromPath(String iconPath); }
Path implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Path)) { return false; } Path target = (Path) obj; if ((separators & HASH_MASK) != (target.separators & HASH_MASK)) { return false; } String[] targetSegments = target.segments; int i = segments.length; if (i != targetSegments.length) { return false; } while (--i >= 0) { if (!segments[i].equals(targetSegments[i])) { return false; } } return true; } Path(String fullPath); private  Path(String[] segments, int separators); static Path createFromAbsolutePath(String path); static Path createFromSegments(String[] segments); Path addFileExtension(String extension); Path addTrailingSeparator(); Path append(Path tail); Path append(String tail); @Override boolean equals(Object obj); @Override int hashCode(); String getFileExtension(); boolean hasTrailingSeparator(); boolean isAbsolute(); boolean isEmpty(); boolean isPrefixOf(Path anotherPath); boolean isRoot(); static boolean isValidPath(String path); String lastSegment(); Path makeAbsolute(); Path makeRelative(); int matchingFirstSegments(Path anotherPath); Path removeFileExtension(); Path removeFirstSegments(int count); Path removeLastSegments(final int count); Path removeTrailingSeparator(); String segment(int index); int segmentCount(); String[] segments(); @Override String toString(); Path uptoSegment(final int count); static String getFileNameFromPath(String iconPath);  }