String (PsiExpression arg) { PsiLambdaExpression lambda = tryCast(skipParenthesizedExprDown(arg), PsiLambdaExpression.class); if (lambda == null) return null; PsiParameter[] parameters = lambda.getParameterList().getParameters(); if (parameters.length != 1) return null; PsiParameter parameter = parameters[0]; PsiElement body = lambda.getBody(); if (body == null) return null; String methodName = null; for (PsiReferenceExpression ref : VariableAccessUtils.getVariableReferences(parameter, body)) { PsiMethodCallExpression call = ExpressionUtils.getCallForQualifier(ref); if (call == null || !call.getArgumentList().isEmpty()) return null; String name = call.getMethodExpression().getReferenceName(); if (name == null || (methodName != null && !methodName.equals(name))) return null; methodName = name; } return methodName; }