Scala Design Patterns.
上QQ阅读APP看书,第一时间看更新

The iterator design pattern

The iterator design pattern is when an iterator is used to traverse a container and access its elements. It helps to decouple containers from the algorithms performed on them. What an iterator should provide is sequential access to the elements of an aggregate object without exposing the internal representation of the iterated collection.