8. Enumerators
Enumerators provide a mechanism for accessing all of the objects in a collection sequentially without exposing the collection’s underlying data structures. Enumerators are used to write flexible and efficient code for using collection classes without tying applications to specific implementations. Furthermore, enumerators provide a uniform interface to collection classes that can be extended to meet a wide range of needs including alternative traversal orders and algorithms.
Enumerators rely on the Anonymous Type pattern and make Heterogeneous Containers more powerful. Objective-C 2.0, available with Mac OS 10.5, Leopard, adds language features to further enhance Enumerators by reducing the amount of repetitive code needed to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access