/** * Split path into components on the "/" character. * The path should not start with "/". * This is consumed by Thrift interface, so the return result should be * {@code List<String>} * * @param path input oath e.g. {@code foo/bar} * @return list of components, e.g. [foo, bar] */ private static List<String> splitPath(String path) { return Lists.newArrayList(PathUtils.splitPath(path)); }
String[] pathComponents = PathUtils.splitPath(path); List<String> paths = new ArrayList<>(pathComponents.length); Collections.addAll(paths, pathComponents);