void (@NotNull PsiStatement statement, @NotNull ImmutableCollectionModel model) { PsiMethodCallExpression call = model.myCall; PsiType type = call.getType(); if (type == null) return; String[] names = getNameSuggestions(call, type); if (names.length == 0) return; String name = names[0]; PsiDeclarationStatement declaration = createDeclaration(name, type, model, statement); if (declaration == null) return; PsiVariable declaredVariable = (PsiVariable)declaration.getDeclaredElements()[0]; addUpdates(name, model, declaration); if (call.getParent() instanceof PsiExpressionStatement) { new CommentTracker().deleteAndRestoreComments(statement); } else { PsiReplacementUtil.replaceExpression(call, name, new CommentTracker()); } myUpdater.rename(declaredVariable, List.of(names)); }