java.lang.Object
org.refcodes.struct.PathComparator
- All Implemented Interfaces:
Comparator<String>
Comparator for path elements, it takes care to sort index values correctly,
e.g. "1000" must come after "9": The paths "/foo/bar/1000/wow" and
"/foo/bar/9/wow" should be sorted as follows:
"/foo/bar/9/wow"
"/foo/bar/1000/wow"
-
Constructor Summary
ConstructorDescriptionPathComparator
(char aDelimiter) Constructs thePathComparator
with the given path delimiter.PathComparator
(char aDelimiter, PathSortStrategy aPathSortStrategy) Constructs thePathComparator
with the given path delimiter. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PathComparator
public PathComparator(char aDelimiter) Constructs thePathComparator
with the given path delimiter.- Parameters:
aDelimiter
- The path delimiter to use.
-
PathComparator
Constructs thePathComparator
with the given path delimiter.- Parameters:
aDelimiter
- The path delimiter to use.aPathSortStrategy
- ThePathSortStrategy
to use for comparisons.
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<String>
-