void (@NotNull List<String> historyFileNamesToKeep, @NotNull Project project) { String projectPath = Objects.requireNonNull(project.getBasePath()); List<String> toRemove = new ArrayList<>(); for (CommandHistoryFileInfo info : myMap.values()) { if (projectPath.equals(info.myProjectPath) && !historyFileNamesToKeep.contains(info.myFilename)) { toRemove.add(info.myFilename); } } deleteHistoryFiles(toRemove, "closed sessions"); }