AddingTerminal (TerminalBlock tb, PsiMethodCallExpression call) { if (!isCallOf(call, JAVA_UTIL_COLLECTION, "add")) return null; PsiExpression qualifierExpression = call.getMethodExpression().getQualifierExpression(); if (qualifierExpression == null) return null; PsiExpression count = tb.getCountExpression(); PsiLocalVariable variable = extractQualifierVariable(tb, call); if (variable != null) { InitializerUsageStatus status = getInitializerUsageStatus(variable, tb.getStreamSourceStatement()); AddingTerminal terminal = new AddingTerminal(variable, tb.getVariable(), call, tb.getStreamSourceStatement(), status); if (count == null) return terminal; // like "list.add(x); if(list.size() >= limit) break;" if (CollectionUtils.isCollectionOrMapSize(count, qualifierExpression) && InheritanceUtil.isInheritor(PsiUtil.resolveClassInClassTypeOnly(variable.getType()), JAVA_UTIL_LIST)) { return terminal; } } return null; }