private void walkNodeTree(final SequencedSet<DocRef> nodePath,
                              final List<ExplorerNode> nodes,
                              final TreeConsumer consumer) {
        if (nodes != null) {
            for (final ExplorerNode node : nodes) {
                if (consumer.consume(nodePath, node)) {
                    // init capacity of LinkedHashSet will likely be 12 which is prob fine
                    // for the depth of most trees
                    final SequencedSet<DocRef> newAncestors = new LinkedHashSet<>(nodePath);
                    newAncestors.add(node.getDocRef());
                    walkNodeTree(newAncestors, node.getChildren(), consumer);
                }
            }
        }
    }
Create a map of folders and their child items.
stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/ExplorerServiceImpl.java