void (@NotNull PsiMethodCallExpression expression) { if (iteratorUsed || numCallsToIteratorNext > 1) return; if (expression.getArgumentList().isEmpty()) { final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if (HardcodedMethodConstants.NEXT.equals(methodName)) { final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (ExpressionUtils.isReferenceTo(qualifier, iterator) && isExecutedExactlyOnce(expression)) { numCallsToIteratorNext++; return; } } } super.visitMethodCallExpression(expression); }