void (PsiElement root) { Collection<PsiLambdaExpression> lambdas = PsiTreeUtil.findChildrenOfType(root, PsiLambdaExpression.class); if(!lambdas.isEmpty()) { for(PsiLambdaExpression lambda : lambdas) { replaceLambdaWithMethodReference(lambda); } } }