Predicate<VirtualFile> (Project project) { return virtualFile -> { if (!virtualFile.isValid()) { return true; } for (Pair<IndexableFileSet, Project> set : myIndexableSets) { final Project proj = set.second; if (proj != null && !proj.equals(project)) { continue; // skip this set as associated with a different project } if (ReadAction.compute(() -> set.first.isInSet(virtualFile))) { return true; } } return false; }; }