void (PsiLambdaExpression lambda) { lambda = extractSideEffects(lambda); if (lambda == null) return; PsiMethodCallExpression callExpression = PsiTreeUtil.getParentOfType(lambda, PsiMethodCallExpression.class); if (callExpression == null) return; PsiElement body = lambda.getBody(); PsiExpression expression = LambdaUtil.extractSingleExpressionFromBody(body); if (expression != null) { replaceExpression(callExpression, lambda); } else if (body instanceof PsiCodeBlock) { replaceCodeBlock(lambda); } }