Iterator interface, basic

This commit is contained in:
Xevion
2020-01-29 20:53:52 -06:00
parent 44343c2409
commit e0ce541471

View File

@@ -79,11 +79,15 @@ However, the real power comes from the next set of interfaces, and the special m
### Iterator Interface ### Iterator Interface
Iterators are specialized data structures that allow traversal, data access, and data deletion (directly to the linked *original* collection).
They are similar to Java's Enumeration interface.
### Iterable Interface ### Iterable Interface
The Iterable interface is the root interface for all the collection classes. The Collection interface extends the Iterable interface and therefore all the subclasses of Collection interface also implement the Iterable interface. The Iterable interface is the root interface for all the collection classes. The Collection interface extends the Iterable interface and therefore all the subclasses of Collection interface also implement the Iterable interface.
It contains only one abstract method, `Iterator<T> iterator()` which returns the `Iterator` object used to iterate over the elements of the datastructure (type `T`). It contains only one abstract method, `Iterator<T> iterator()` which returns the `Iterator` object used to iterate over the elements of the data structure (type `T`).
### Collection Interface ### Collection Interface