void (T key, String path) { path = Strings.trimStart(path, myRoot); myPaths.put(key, path); Node current = myRootNode; Iterator<String> pathComponentsIterator = new PathComponentsIterator(path); while (pathComponentsIterator.hasNext()) { String word = pathComponentsIterator.next(); current = current.findOrAddChild(word); } for (Node c = current; c != null; c = c.myParentNode) ++c.myNestedChildrenCount; }