Class PathComparator

java.lang.Object
org.refcodes.struct.PathComparator
All Implemented Interfaces:
Comparator<String>

public class PathComparator extends Object implements 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 Details

    • PathComparator

      public PathComparator(char aDelimiter)
      Constructs the PathComparator with the given path delimiter.
      Parameters:
      aDelimiter - The path delimiter to use.
    • PathComparator

      public PathComparator(char aDelimiter, PathSortStrategy aPathSortStrategy)
      Constructs the PathComparator with the given path delimiter.
      Parameters:
      aDelimiter - The path delimiter to use.
      aPathSortStrategy - The PathSortStrategy to use for comparisons.
  • Method Details