void (@NotNull Project project, @NotNull PsiMethodCallExpression call, @NotNull Context context) { CommentTracker ct = new CommentTracker(); String text = ct.text(context.myMapLambdaParameter) + " ->" + ct.text(context.myOptionalExpression); PsiExpression qualifier = context.myMapCall.getMethodExpression().getQualifierExpression(); String callReplacement = Objects.requireNonNull(qualifier).getText() + ".flatMap(" + text + ")"; PsiElement result = ct.replaceAndRestoreComments(context.myMapCall, callReplacement); LambdaCanBeMethodReferenceInspection.replaceAllLambdasWithMethodReferences(result); }