Class CommonPath

Object
CommonPath

public class CommonPath extends Object
Finds the common root directory of a set of paths.

This is the maximal leftmost common part of all paths (when treated in a canonical way).

Author:
Owen Feehan
  • Method Details

    • fromPaths

      public static Optional<Path> fromPaths(Iterable<Path> paths)
      Finds the common root directory of several Paths.
      Parameters:
      paths - the paths
      Returns:
      the common root directory, if it exists.
    • fromStrings

      public static Optional<Path> fromStrings(Collection<String> paths)
      Finds the common root directory of several paths, encoded in Strings.
      Parameters:
      paths - the paths
      Returns:
      the common root directory, if it exists.
    • fromFiles

      public static Optional<Path> fromFiles(Collection<File> files)
      Finds the common root directory of the paths to several Files.
      Parameters:
      files - the files
      Returns:
      the common root directory, if it exists.