private Path append(Iterable<String> segments, boolean trailingSlash) {
            Node node = head;
            int count = 0;
            for (String segment : segments) {
                node = new Node(node, validator.apply(segment));
                count++;
            }
            return new Path(node, length + count, trailingSlash, validator);
        }
Returns a copy of this all given segments appended, with a trailing slash as per this path.
vespajlib/src/main/java/ai/vespa/http/HttpURL.java