迭代器
- 网络ITERATOR;iterators;IEnumerator
-
在匿名迭代器中的Return语句工作方式就像C的yieldreturn一样。
A Return statement within an anonymous Iterator works just like C # 's yield return .
-
C的迭代器是一种延续的形式,在类似Scheme这样的流行语言中很少使用这样的技术。
C # 's iterator is a form of continuation , a rarely used technique popular in languages such as Scheme .
-
VisualBasic的迭代器,看上去更像一个匿名函数。
Visual Basic 's Iterators , look more like an anonymous function .
-
First和last申明输入迭代器,是一个模板参数。
First and last are declared to be of type InputIterator , and InputIterator is a template parameter .
-
尽管有些迭代器对整数索引进行了优化,但是所有迭代器都只简单地处理(key,value)对。
While some iterators are optimized for integer indices , all simply process ( key , value ) pairs .
-
与更加特定于域的语言特性(如C中的迭代器)相比,这种语言特性可能更为有用。
It would be likely more useful than more domain-specific language features such as iterators in C # .
-
Find需要三个参数:两个迭代器定义了一个区域,还有一个要查找的值。
Find takes three arguments : two iterators that define a range , and a value to search for in that range .
-
指针本身是迭代器,这就是为什么C数组也可以使用reverse这个函数。
Pointers themselves are iterators , which is why it is possible to reverse the elements of a C array .
-
而在Blue中,忽略了递归或映射(函数迭代器),只有一种方法来实现循环结构。
In Blue , ignoring recursion or map ( functional iterator ), there 's one way to implement loop constructs .
-
您会回忆起这个系列以前的文章中,闭包一般用于在List和Map集合上应用的迭代器方法上。
You 'll recall from previous articles in this series that closures are commonly used with iterator methods applied to List and Map collections .
-
在PHP中,这意味着对象可以当做迭代器。
In PHP parlance , this means that the object can be treated as an iterator .
-
VisualBasic团队的PaulVick最近泄露了一个计划&在一个还没有取名的版本中添加迭代器。
Visual Basic 's Paul Vick recently revealed a proposal to add iterators in a yet unnamed version .
-
很容易就能将Rope迭代器改成一次向前移动不止一个字符。
You can easily modify the Rope iterator to accommodate skipping forward by more than one character at a time .
-
Groovy将这一技术进一步发展,添加了内部迭代器作为集合API的一部分。
Groovy has taken this one step further and added internal iterators as part of the collections API .
-
其中最重要的差异是,序列既可编制索引,也可直接切片(slice),而迭代器不能。
The most important of these differences is that sequences can be indexed , and directly sliced , while iterators cannot .
-
它们与PHP中的其他迭代器类使用相同的工作方式,但是它们分别针对不同的情况。
These work the same as the other iterator classes in PHP , but they are specially designed for certain instances .
-
该清单展示了内部迭代器(也称为push迭代器,因为它将每个元素依次推到代码块中)。
This listing illustrates an internal iterator ( also known as a push iterator because it pushes each element in turn to the code block ) .
-
例如,迭代器方法collect把闭包应用到集合中的每个元素上,并返回一个带有新值的新集合。
The iterator method collect , for example , applies a closure to every element in a collection and returns a new collection with the new values .
-
STL和迭代器模式
STL and Iterator Design Pattern
-
前几个例子展示了更为现代的基于Java的语言包含了四人组模式,该语言中直接包含了迭代器和命令模式。
The first couple of examples show this exact embrace of Gang of Four patterns in more modern Java-based languages , incorporating the Iterator and Command patterns directly into the language .
-
中间值通过迭代器(一种可以让程序员遍历所有集合元素的对象,忽略其具体的实现)提供给用户的Reduce函数。
The intermediate values are supplied to the user 's Reduce function via an iterator ( an object that allows a programmer to traverse through all the elements of a collection regardless of its specific implementation ) .
-
而charAt实现直接返回char原语,迭代器实现必须将每个char装箱为一个Character对象。
Although the charAt implementation directly returns char primitives , the iterator implementation must box each char into a Character object .
-
迭代器的内容按顺序写入,首先是字符串JavaBridge!,然后是JavaDate对象,最后是包含五个数字的PHP数组。
The contents of the iterator are written in order , starting with the string Java Bridge !, then the Java Date object , and finishing with the PHP array containing five numbers .
-
RUP过程鼓励复用,设计过程中使用很多设计模式来增加复用性,如抽象工厂、观察者模式和迭代器模式等。
Design patterns are also used to increase the reusability as RUP advocated . The abstract factory , observer and iterator patterns is introduced .
-
但是向后移动要复杂些,因为迭代器内部执行的是深度优先算法,预先排好了Rope遍历的顺序,需要访问每个叶节点。
But moving backward is more complicated , because internally the iterator performs a depth-first , preorder traversal of the Rope , visiting each of its leaf nodes .
-
还出现了iter()内置函数,它可以将许多类似于序列的对象转换为迭代器。
We have the iter () built-in function to turn many sequence-like objects into iterators .
-
所有类序列或类迭代器的主要相似之处是,它们都允许进行循环遍历,无论是使用for循环、列表理解(listcomprehension)还是生成器理解(generatorcomprehension)。
The main point of similarity is that everything that is sequence-or iterator-like lets you loop over it , whether using a for loop , a list comprehension , or a generator comprehension .
-
在这里,我跳过了Iterator接口,直接在集合上使用类似迭代器的方法。
Here , I get to bypass the Iterator interface and use iterator-like methods on collections themselves .
-
可以将for循环与提供迭代器的任何Python对象结合使用,这些对象包括tuple、string和list等内置序列类型。
You can use the for loop with any Python object that provides an iterator , including the built-in sequence types such as the tuple , string , and list .
-
如果你了解算法,迭代器,容器,那么你基本上知道STL的一切。
If you understand algorithms , iterators , and containers , then you understand almost everything there is to know about the STL .