@Override
  public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
    return new JavaElementVisitor() {
      @Override
      public void visitLambdaExpression(@NotNull PsiLambdaExpression lambda) {
        PsiElement parent = lambda.getParent();
        if (!(parent instanceof PsiExpressionList)) return;
        PsiMethodCallExpression call = ObjectUtils.tryCast(parent.getParent(), PsiMethodCallExpression.class);
        if (call == null) return;
        if (!(lambda.getBody() instanceof PsiExpression expr)) return;
        if (!ExpressionUtils.isSafelyRecomputableExpression(expr)) return;
        if (ContainerUtil.or(lambda.getParameterList().getParameters(),
                             param -> ExpressionUtils.isReferenceTo(expr, param))) {
          return;
        }
        if (LIST_REPLACE_ALL.test(call)) {
          registerProblem(lambda, expr, new ReplaceWithCollectionsFillFix());
          return;
        }
        for (LambdaAndExplicitMethodPair info : LambdaAndExplicitMethodPair.INFOS) {
          if (info.isLambdaCall(call, lambda)) {
            registerProblem(lambda, expr, new RemoveExcessiveLambdaFix(info, info.getExplicitMethodName(call)));
          }
        }
      }

      private void registerProblem(PsiLambdaExpression lambda, PsiExpression expr, LocalQuickFix fix) {
        holder.registerProblem(lambda, JavaBundle.message("inspection.excessive.lambda.message"),
                               ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                               new TextRange(0, expr.getStartOffsetInParent()),
                               fix);
      }
    };
  }
@Override
  public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly)