Iterable<ResultWithContext> (@NotNull String name, @NotNull MultiMap<String, PsiClass> ownClasses, @NotNull MultiMap<String, PsiImportStatement> typeImports, @NotNull MultiMap<String, PsiImportStaticStatement> staticImports) { List<ResultWithContext> result = new ArrayList<>(); for (PsiClass psiClass : ownClasses.get(name)) { result.add(new ResultWithContext(psiClass, null)); } for (PsiImportStatement statement : typeImports.get(name)) { PsiElement target = statement.resolve(); if (target instanceof PsiClass) { result.add(new ResultWithContext((PsiNamedElement)target, statement)); } } for (PsiImportStaticStatement statement : staticImports.get(name)) { PsiJavaCodeReferenceElement reference = statement.getImportReference(); if (reference != null) { for (JavaResolveResult result1 : reference.multiResolve(false)) { PsiElement element = result1.getElement(); if (element instanceof PsiNamedElement) { result.add(new ResultWithContext((PsiNamedElement)element, statement)); } } } } return JBIterable.from(result).unique(ResultWithContext::getElement); }