PsiExpression operand = StreamApiMigrationInspection.extractIncrementedLValue(tb.getSingleExpression(PsiExpression.class));
if (!(operand instanceof PsiReferenceExpression)) return;
PsiElement element = ((PsiReferenceExpression)operand).resolve();
if (!(element instanceof PsiLocalVariable)) return;
PsiLocalVariable var = (PsiLocalVariable)element;
<BUG>final StringBuilder builder = generateStream(iteratedValue, operations);
</BUG>
builder.append(".count()");
replaceWithNumericAddition(project, foreachStatement, var, builder, PsiType.LONG);
}

PsiExpression operand = StreamApiMigrationInspection.extractIncrementedLValue(tb.getSingleExpression(PsiExpression.class));
if (!(operand instanceof PsiReferenceExpression)) return;
PsiElement element = ((PsiReferenceExpression)operand).resolve();
if (!(element instanceof PsiLocalVariable)) return;
PsiLocalVariable var = (PsiLocalVariable)element;
final StringBuilder builder = generateStream(iteratedValue, tb.getLastOperation());
builder.append(".count()");
replaceWithNumericAddition(project, foreachStatement, var, builder, PsiType.LONG);
