boolean (PsiMethodCallExpression flatMapCall) { PsiElement function = flatMapCall.getArgumentList().getExpressions()[0]; if (function instanceof PsiMethodReferenceExpression methodRef) { if (!STREAM_METHOD.equals(methodRef.getReferenceName())) return false; PsiMethod method = ObjectUtils.tryCast(methodRef.resolve(), PsiMethod.class); if (method != null && STREAM_METHOD.equals(method.getName()) && method.getParameterList().isEmpty()) { final PsiClass containingClass = method.getContainingClass(); if (containingClass != null && CommonClassNames.JAVA_UTIL_COLLECTION.equals(containingClass.getQualifiedName())) { return true; } } } else if (function instanceof PsiLambdaExpression) { PsiExpression expression = extractLambdaReturnExpression((PsiLambdaExpression)function); return expression instanceof PsiMethodCallExpression && COLLECTION_STREAM.test((PsiMethodCallExpression)expression); } return false; }