void (RootNode node, List<String> path, int index) { if (index < path.size()) { String name = path.get(index); Group group = groups.get(name); if (group == null) { group = new Group(name); groups.put(name, group); } group.add(node, path, index + 1); } else { roots.add(node); } }