private String createNewVariableName(
     @NotNull PsiForStatement scope, PsiType type, @Nullable String containerName) {
   final Project project = scope.getProject();
   final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
   @NonNls String baseName;
   if (containerName != null) {
     baseName = StringUtils.createSingularFromName(containerName);
   } else {
     final SuggestedNameInfo suggestions =
         codeStyleManager.suggestVariableName(VariableKind.LOCAL_VARIABLE, null, null, type);
     final String[] names = suggestions.names;
     if (names != null && names.length > 0) {
       baseName = names[0];
     } else {
       baseName = "value";
     }
   }
   if (baseName == null || baseName.isEmpty()) {
     baseName = "value";
   }
   return codeStyleManager.suggestUniqueVariableName(baseName, scope, true);
 }