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
ConstructorsConstructorDescriptionPathComparator(char aDelimiter) Constructs thePathComparatorwith the given path delimiter.PathComparator(char aDelimiter, PathSortStrategy aPathSortStrategy) Constructs thePathComparatorwith the given path delimiter. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PathComparator
public PathComparator(char aDelimiter) Constructs thePathComparatorwith the given path delimiter.- Parameters:
aDelimiter- The path delimiter to use.
-
PathComparator
Constructs thePathComparatorwith the given path delimiter.- Parameters:
aDelimiter- The path delimiter to use.aPathSortStrategy- ThePathSortStrategyto use for comparisons.
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<String>
-