public static List<String> stripDotPathComponents(List<String> input) {
        List<String> output = new ArrayList<>();
        for (String string : input) {
            if (string.equals("..")) {
                if (!output.isEmpty()) {
                    output.remove(output.size() - 1);
                }
            } else if (!string.equals(".")) {
                output.add(string);
            }
        }
        return output;
    }
Convert a path to a list of path components.
Multiple slashes in a row are treated the same as a single slash.
Trailing slashes are ignored.
shell/src/main/java/org/apache/kafka/shell/command/CommandUtils.java