List<VirtualFile> (VirtualFile dir, Project project) { final List<VirtualFile> javaFiles = new ArrayList<>(); ProjectFileIndex.getInstance(project).iterateContentUnderDirectory(dir, file -> { if (file.getName().endsWith(".java")) { javaFiles.add(file); } return true; }); return javaFiles; }