/** * {@inheritDoc} */ public int compareTo( Path that ) { if (this == that) return 0; Iterator<Segment> thisIter = getSegmentsList().iterator(); Iterator<Segment> thatIter = that.iterator(); while (thisIter.hasNext() && thatIter.hasNext()) { Segment thisSegment = thisIter.next(); Segment thatSegment = thatIter.next(); int diff = thisSegment.compareTo(thatSegment); if (diff != 0) return diff; } if (thisIter.hasNext()) return 1; if (thatIter.hasNext()) return -1; return 0; }
public int compare( Path.Segment o1, Path.Segment o2 ) { if (o1 == o2) return 0; if (o1 == null) return -1; if (o2 == null) return 1; return o1.compareTo(o2); } };