void (@NotNull final File file) { File f; File parent = file.getParentFile(); for (f = file; parent != null; f = parent, parent = parent.getParentFile()) { Collection<File> files = myParentToChildrenMap.get(parent); if (files == null) { myParentToChildrenMap.put(parent, files = new HashSet<>()); } files.add(f); } myRoots.add(f); }