boolean (@NotNull PsiLambdaExpression lambda, @NotNull Supplier<? extends PsiElement> newBodySupplier) { return isSafeLambdaReplacement(lambda, l -> { PsiElement oldBody = l.getBody(); PsiElement newBody = newBodySupplier.get(); if (oldBody == null || newBody == null) return null; oldBody.replace(newBody); return l; }); }