private ResourcePathIterator()

in src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java [1277:1298]


        private ResourcePathIterator(String path) {
            if (path == null || path.length() == 0) {
                // null or empty path, there is nothing to return
                nextPath = null;
            } else {
                // find last non-slash character
                int i = path.length() - 1;
                while (i >= 0 && path.charAt(i) == '/') {
                    i--;
                }
                if (i < 0) {
                    // only slashes, assume root node
                    nextPath = "/";
                } else if (i < path.length() - 1) {
                    // cut off slash
                    nextPath = path.substring(0, i + 1);
                } else {
                    // no trailing slash
                    nextPath = path;
                }
            }
        }