The iterator pattern provides a way to encapsulate looping through a collection or array of objects.
迭代器模式将提供一种通过对象集合或对象数组封装迭代的方法。
Create an iterator to iterate through the collection.
创建一个迭代器,以便通过集合进行迭代。
The iterator method collect, for example, applies a closure to every element in a collection and returns a new collection with the new values.
例如,迭代器方法collect把闭包应用到集合中的每个元素上,并返回一个带有新值的新集合。
应用推荐