IteratorDeclaration (PsiForStatement statement) { if (statement.getUpdate() != null) return null; PsiStatement initialization = statement.getInitialization(); IteratorDeclaration declaration = extract(initialization); if (declaration == null || !declaration.isHasNextCall(statement.getCondition())) return null; return declaration; }