Iterator API Documentation
- class Iterator[source]
Bases:
Generic[T]Defines the interface for traversing elements in a collection.
- has_next()[source]
Check if there are more elements to traverse.
- Return type:
- Returns:
True if more elements exist, False otherwise.
- next()[source]
Retrieve the next element in the collection.
- Return type:
TypeVar(T)- Returns:
The next element.
- Raises:
StopIteration – If no more elements exist.
- class ConcreteIterator(collection)[source]
Bases:
Iterator[T]Implements the Iterator interface for traversing a list.
- Parameters:
collection (List[T])
- has_next()[source]
Check if there are more elements to traverse.
- Return type:
- Returns:
True if more elements exist, False otherwise.
- next()[source]
Retrieve the next element in the collection.
- Return type:
TypeVar(T)- Returns:
The next element.
- Raises:
StopIteration – If no more elements exist.
- class ConcreteAggregate[source]
Bases:
Aggregate[T]Implements the Aggregate interface and provides a method to create an iterator.