@Override public boolean startsWith( Path other ) { if (other.size() > this.size()) return false; Iterator<String> thatIter = other.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext() && thisIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } return !thatIter.hasNext(); }
@Override public boolean startsWith( Path other ) { if (other.size() > this.size()) return false; Iterator<String> thatIter = other.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext() && thisIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } return !thatIter.hasNext(); }
@Override public int compareTo( Path that ) { if (that == this) return 0; int diff = this.size() - that.size(); if (diff != 0) return diff; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { int value = thisIter.next().compareTo(thatIter.next()); if (value != 0) return value; } assert !thisIter.hasNext(); return 0; }
@Override public int compareTo( Path that ) { if (that == this) return 0; int diff = this.size() - that.size(); if (diff != 0) return diff; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { int value = thisIter.next().compareTo(thatIter.next()); if (value != 0) return value; } assert !thisIter.hasNext(); return 0; }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof Path) { Path that = (Path)obj; if (this.size() != that.size()) return false; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } assert !thisIter.hasNext(); return true; } return false; }
@Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof Path) { Path that = (Path)obj; if (this.size() != that.size()) return false; Iterator<String> thatIter = that.iterator(); Iterator<String> thisIter = this.iterator(); while (thatIter.hasNext()) { if (!thisIter.next().equals(thatIter.next())) return false; } assert !thisIter.hasNext(); return true; } return false; }