This is the 22nd post in a series on design patterns. Iterator is a behavioral design pattern that lets you traverse elements of a collection without exposing its underlying representation (list, stack, tree, etc.) Iterator Design Pattern This pattern extracts the traversal behavior of a collection into a separate object called an iterator…