TerminalOperation (@NotNull PsiType elementType, @NotNull PsiType resultType, PsiExpression expr) { expr = PsiUtil.skipParenthesizedExprDown(expr); if (!(expr instanceof PsiMethodCallExpression collectorCall)) return null; PsiExpression[] collectorArgs = collectorCall.getArgumentList().getExpressions(); PsiMethod collector = collectorCall.resolveMethod(); if (collector == null) return null; PsiClass collectorClass = collector.getContainingClass(); if (collectorClass != null && CommonClassNames.JAVA_UTIL_STREAM_COLLECTORS.equals(collectorClass.getQualifiedName())) { return fromCollector(elementType, resultType, collector, collectorArgs); } return null; }