use ContainerUtil.process

This commit is contained in:
Dmitry Batkovich
2016-10-27 10:29:36 +03:00
parent 837d95f6d2
commit 4901e1fc85
2 changed files with 5 additions and 15 deletions
@@ -297,14 +297,10 @@ public class JavaDirectInheritorsSearcher implements QueryExecutor<PsiClass, Dir
if (!acceptAnonymous) {
classStream = classStream.filter(c -> !(c instanceof PsiAnonymousClass));
}
Iterator<PsiClass> it = classStream.iterator();
while (it.hasNext()) {
return ContainerUtil.process(classStream.iterator(), c -> {
ProgressManager.checkCanceled();
PsiClass next = it.next();
if (checkInheritance && ReadAction.compute(() -> !next.isInheritor(baseClass, false))) continue;
if (!consumer.process(next)) return false;
}
return true;
if (checkInheritance && ReadAction.compute(() -> !c.isInheritor(baseClass, false))) return true;
return consumer.process(c);
});
}
}
@@ -362,13 +362,7 @@ public class JavaFunctionalExpressionSearcher extends QueryExecutorBase<PsiFunct
@NotNull SamDescriptor descriptor,
@NotNull Processor<PsiFunctionalExpression> consumer) {
if (funExprInfo != null) {
Iterator<PsiFunctionalExpression> it = funExprInfo.getHierarchyChildren().iterator();
while (it.hasNext()) {
PsiFunctionalExpression next = it.next();
if (!consumer.process(next)) {
return false;
}
}
if (!ContainerUtil.process(funExprInfo.getHierarchyChildren().iterator(), consumer)) return false;
GlobalSearchScope dirtyScope = funExprInfo.getDirtyScope();
descriptor.effectiveUseScope = descriptor.effectiveUseScope.intersectWith(dirtyScope);
}