Class PathUtil


  • public class PathUtil
    extends java.lang.Object
    The PathUtil class provides static helper functions useful for working with directory paths.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> extend​(java.util.List<java.lang.String> path, java.lang.String... subPaths)
      Extends a path by an arbitrary number of elements.
      static java.util.List<java.lang.String> from​(java.lang.String... subPaths)
      Creates a new path from an arbitrary number of elements.
      static java.util.List<java.lang.String> join​(java.util.List<java.lang.String> path1, java.util.List<java.lang.String> path2)
      Joins two paths into one larger path.
      static java.util.List<java.lang.String> popBack​(java.util.List<java.lang.String> path)
      Removes the last item from a path.
      static java.util.List<java.lang.String> popFront​(java.util.List<java.lang.String> path)
      Removes the first item from a path.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • join

        public static java.util.List<java.lang.String> join​(java.util.List<java.lang.String> path1,
                                                            java.util.List<java.lang.String> path2)
        Joins two paths into one larger path.
        Parameters:
        path1 - The first path to join
        path2 - The path to append to path1
        Returns:
        a new list which contains all the items in path1 followed by all the items in path2
      • extend

        public static java.util.List<java.lang.String> extend​(java.util.List<java.lang.String> path,
                                                              java.lang.String... subPaths)
        Extends a path by an arbitrary number of elements.
        Parameters:
        path - The path to extend
        subPaths - The items to append to path
        Returns:
        a new list which contains all the items in path followed by all additional items specified in subPaths
      • from

        public static java.util.List<java.lang.String> from​(java.lang.String... subPaths)
        Creates a new path from an arbitrary number of elements.
        Parameters:
        subPaths - The items in the path
        Returns:
        a list which contains all the items specified in subPaths
      • popFront

        public static java.util.List<java.lang.String> popFront​(java.util.List<java.lang.String> path)
        Removes the first item from a path.
        Parameters:
        path - the path whose first item is being popped
        Returns:
        a new list which contains all the items in path except for the first item
      • popBack

        public static java.util.List<java.lang.String> popBack​(java.util.List<java.lang.String> path)
        Removes the last item from a path.
        Parameters:
        path - the path whose last item is being popped
        Returns:
        a new list which contains all the items in path except for the last item