void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { CommentTracker commentTracker = new CommentTracker(); PsiMethodCallExpression call = (PsiMethodCallExpression) element; PsiLocalVariable variable = updater.getWritable(variablePointer.getElement()); if (variable == null) return; ExpressionUtils.bindCallTo(call, "compute"); String variableName = variable.getName(); PsiExpressionList argsList = call.getArgumentList(); PsiExpression[] args = argsList.getExpressions(); if(args.length != 2) return; PsiExpression exp = args[1]; VariableNameGenerator generator = new VariableNameGenerator(call, VariableKind.PARAMETER); String keyName = generator.byName("k", "key").generate(true); String lambdaParameters = "(" + keyName + ", " + variableName + ")"; String lambdaExpressionText = lambdaParameters + " -> " + commentTracker.text(exp); commentTracker.delete(variable); commentTracker.replaceExpressionAndRestoreComments(exp, lambdaExpressionText); }