void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiExpressionStatement statement = tryCast(element, PsiExpressionStatement.class); if (statement == null) return; PsiMethodCallExpression call = tryCast(statement.getExpression(), PsiMethodCallExpression.class); if (call == null) return; SimplifyForEachInspection.SimplifyForEachContext simplifyForEachContext = SimplifyForEachInspection.SimplifyForEachContext.from(call); if (simplifyForEachContext == null) return; PsiElement result = simplifyForEachContext.migrate(); if (result == null) return; MigrateToStreamFix.simplify(project, result); }