void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiForStatement statement = tryCast(element, PsiForStatement.class); if (statement == null) return; CountingLoop loop = CountingLoop.from(statement); if (loop == null) return; PsiAssignmentExpression assignment = ExpressionUtils.getAssignment(ControlFlowUtils.stripBraces(statement.getBody())); if (assignment == null) return; IndexedContainer container = getContainer(loop, assignment); if (container == null) return; PsiExpression rValue = assignment.getRExpression(); if (rValue == null) return; CommentTracker ct = new CommentTracker(); PsiElement result; if (myIsRhsConstant) { String cast = getCast(statement, container.getElementType(), rValue.getType()); String replacement = CommonClassNames.JAVA_UTIL_ARRAYS + ".fill(" + ct.text(container.getQualifier()) + ", " + cast + ct.text(rValue) + ");"; result = ct.replaceAndRestoreComments(statement, replacement); } else { String replacement = CommonClassNames.JAVA_UTIL_ARRAYS + ".setAll(" + ct.text(container.getQualifier()) + ", " + loop.getCounter().getName() + "->" + ct.text(rValue) + ");"; result = ct.replaceAndRestoreComments(statement, replacement); LambdaCanBeMethodReferenceInspection.replaceAllLambdasWithMethodReferences(result); } result = JavaCodeStyleManager.getInstance(project).shortenClassReferences(result); CodeStyleManager.getInstance(project).reformat(result); }