ITERATOR 中文是什么意思 - 中文翻译

迭代器
一个iterator

在 英语 中使用 Iterator 的示例及其翻译为 中文

{-}
  • Political category close
  • Ecclesiastic category close
  • Programming category close
What is an Iterator?
那么什么是iterator?
This new iterator is part of the ECMAScript 6.
这个新的迭代是ECMAScript6的一部分。
We have seen that the for statement is such an iterator.
我们已经看到for语句是这样的iterator
Get value of an iterator, int x=*it;
从迭代器取值,intx=*it;.
Iterators all implement a trait named Iterator that is defined in the standard library.
迭代器都实现了一个叫做Iterator的定义于标准库的trait。
You can get an iterator from that.
你可以从任何一个iterable得到一个iterator
An iterator is an object with a next(Python 2) or__next__(Python 3) method.
迭代器对象是一个含有next(Python2)或者__next__(Python3)方法的对象。
You can get an iterator from that.
所以你可以从每一个iterable得到一个iterator
Iterator can be used to traverse Set and List collections whereas ListIterator can only be used with Lists.
一个Iterator可以用来遍历Set和List集合,而ListIterator只能用来迭代List。
And of course you can get an iterator from all three.
你可以从任何一个iterable得到一个iterator
At this point the iterator object is exhausted and any further calls to its next() method just raise StopIteration again.
此时,迭代器对象已耗尽,并且再次调用它的__next__()方法只会再次提升StopIteration。
And of course you can get an iterator from all three.
所以你可以从每一个iterable得到一个iterator
However, when you request an iterator from an iterator(which you would rarely do), it just gives you a copy of itself.
但是,当您从迭代器(您很少这样做)请求迭代器时,它只会为您提供自身的副本。
Has a member- or extension-function iterator(), whose return type.
一个iterator()成员函数或扩展函数,其返回类型要.
Sequence unpacking also supports iterators: if you know an iterator will return N elements, you can unpack them into an N-tuple:.
序列解包也支持迭代器:如果你知道迭代器将返回N个元素,则可以将它们解包为N元组:.
The for in construct is able to interact with an Iterator in several ways.
Forin结构能以几种方式与Iterator互动。
Let's see what an iterator implementation looks like in practice.
让我们来看看一个迭代器实现在实践中看起来是什么样的。
For example, consider the following code, which uses an iterator to walk the keys of a hash in Java.
例如,考虑如下这段代码,使一个iterator遍历一个Java中的哈希表的关键字。
The Iterator provided in method iterator() is not guaranteed to traverse the elements of the priority queue in any particular order.
方法iterator()中提供的迭代器并不保证以任意特定的顺序遍历优先级队列中的元素。
A generator is also an iterator, but what is an iterator?
Generator是个iterator,同时是个iterable?
Iterator objects can optionally provide these additional capabilities, but the iterator protocol only specifies the__next__() method.
迭代器对象可以提供这些额外的功能,但迭代器协议只明确了__next__()方法。
Iterable should be in a series, an iterator, or various other object that backs iteration.
Iterable必须是一个序列,或iterator,或其他支持迭代的对象。
For example, the list object isan iterable but not an iterator(it implements__iter__ but not next).
举个例子,list对象是一个可迭代对象,但并不是一个迭代器(它实现了__iter__但并未实现next)。
Here, we're creating an iterator, using two adaptors, and then consuming the value.
这里,我们创建了一个迭代器,使用了两个适配器,接着消费了其值。
Some interesting disagreement about parts of the above(in particular replacing Iterator usage by access-by-index) has been discussed on Reddit here.
对于上面的某些部分有一些比较有趣的分歧(特别是将Iterator的使用替换为通过索引进行访问),具体讨论内容请查阅Reddit。
Similarly, if you wish to get a iterator only, you can use Generator Expression with almost the same syntax.
同样的,如果你只是想要获取一个迭代器,你可以使用语法几乎相通的生成器表达式。
Each Java Collection contains the iteratormethod that returns an Iterator instance.
每一个JavaCollection都包含iterator方法来返回一个Iterator实例。
The incoming method on TcpListener returns an iterator that gives us a sequence of streams(more specifically, streams of type TcpStream).
TcpListener的incoming方法返回一个迭代器,它提供了一系列的流(更准确的说是TcpStream类型的流)。
Therefore, in the face of concurrent modifications, the iterator will soon fail completely without risking any uncertain behavior at any time in the future.
因此,面对并发的修改,迭代器很快就会完全失败,而不冒在将来不确定的时间任意发生不确定行为的风险。
结果: 29, 时间: 0.0388

顶级字典查询

英语 - 中文