[java-psi] filterAnnotations: avoid Streams

Usually the resulting list is 0-1 element but queried kinda often, so stream overhead is visible

GitOrigin-RevId: 06f9932a35b1cfbe4c9a619de986e0c54f8c0c52
This commit is contained in:
Tagir Valeev
2020-12-02 13:04:49 +07:00
committed by intellij-monorepo-bot
parent dde51de143
commit f93ad46282

View File

@@ -105,10 +105,14 @@ public abstract class BaseExternalAnnotationsManager extends ExternalAnnotations
@NotNull
private List<PsiAnnotation> filterAnnotations(@NotNull List<AnnotationData> result, @NotNull String annotationFQN) {
return StreamEx.of(result)
.filter(data -> data.annotationClassFqName.equals(annotationFQN))
.map(data -> data.getAnnotation(this))
.toCollection(SmartList::new);
SmartList<PsiAnnotation> annotations = new SmartList<>();
for (AnnotationData data : result) {
if (data.annotationClassFqName.equals(annotationFQN)) {
PsiAnnotation annotation = data.getAnnotation(this);
annotations.add(annotation);
}
}
return annotations;
}
@Nullable