... 最简单但并非最好的实现迭代器的方法是在实现该ADT的类中定义的迭代器方法,call这样的迭代器为内部迭代器(internal iterator),这时,可以定义一个实现两个接口的类(命名为ListWithInternalIterator),如:BaseicIteratorInterface舆ListInterface。
基于24个网页-相关网页
This listing illustrates an internal iterator (also known as a push iterator because it pushes each element in turn to the code block).
该清单展示了内部迭代器(也称为push迭代器,因为它将每个元素依次推到代码块中)。
Listing 8 shows how to extend the Configuration class to implement the Iterator interface, which is internal to PHP.
清单8显示了如何扩展configuration类来实现Iterator接口,对于php来说,该接口是内部接口。
应用推荐