void (@NotNull PsiForeachStatement statement) { if (!mySuggestMapReplaceAll) return; MapLoopCondition condition = MapLoopCondition.create(statement); if (condition == null) return; PsiMethodCallExpression putCall = condition.extractPut(statement); if (putCall == null) return; PsiExpression[] args = putCall.getArgumentList().getExpressions(); if (args.length != 2) return; PsiExpression key = args[0]; if (!condition.isKeyAccess(key)) return; PsiExpression value = args[1]; if (condition.isEntrySet() && isUsedAsReference(value, condition)) return; if (hasMapUsages(condition, value)) return; if (!LambdaGenerationUtil.canBeUncheckedLambda(value, variable -> condition.getMap().equals(variable))) return; ReplaceWithSingleMapOperation fix = ReplaceWithSingleMapOperation.create("replaceAll", putCall, value); holder.registerProblem(statement.getFirstChild(), QuickFixBundle.message("java.8.map.api.inspection.description", fix.myMethodName), fix); }