void (@NotNull Project project, @NotNull PsiMethodCallExpression call, @NotNull Context context) { PsiExpression receiver = context.myOrElseCall.getMethodExpression().getQualifierExpression(); if (receiver == null) return; String statementText = receiver.getText() + ".ifPresent(" + LambdaUtil.createLambda(context.myVariable, context.myAction) + ");"; PsiStatement finalStatement = JavaPsiFacade.getElementFactory(project).createStatementFromText(statementText, context.myStatement); PsiElement result = context.myStatement.replace(finalStatement); context.myConditionStatement.delete(); LambdaCanBeMethodReferenceInspection.replaceAllLambdasWithMethodReferences(result); }