约 14,200,000 个结果
在新选项卡中打开链接
  1. What are iterator, iterable, and iteration? - Stack Overflow

    An iterator is an object with a next (Python 2) or __next__ (Python 3) method. Whenever you use a for loop, or map, or a list comprehension, etc. in Python, the next method is called …

  2. Incrementing iterators: Is ++it more efficient than it++?

    2018年10月26日 · The reason is that if the iterator class itself is at all complex, then because it++ has to return the value before it is incremented, the implementation will generally make a copy. …

  3. java - What is the difference between iterator and iterable and …

    2011年7月28日 · Iterator is class that manages iteration over an Iterable. It maintains a state of where we are in the current iteration, and knows what the next element is and how to get it.

  4. How to correctly implement custom iterators and const_iterators?

    2010年8月27日 · The reverse iterator is work for nothing, since the standard library provides a reverse-iterator adapter. And you failed to make the iterator type assignable from the const …

  5. How does next() method on iterators work? - Stack Overflow

    2017年12月6日 · At the very first iteration, the iterator starts pointing to element with index 0? or like the "index -1" ? I ask because as far as I know the next() method returns the next element …

  6. Which is more efficient, a for-each loop, or an iterator?

    Iterator is an interface in the Java Collections framework that provides methods to traverse or iterate over a collection. Both iterator and for loop acts similar when your motive is to just …

  7. How to navigate through a vector using iterators? (C++)

    The goal is to access the "nth" element of a vector of strings instead of the [] operator or the "at" method. From what I understand, iterators can be used to navigate through containers, but I've ...

  8. python - How to build a basic iterator? - Stack Overflow

    Iterator objects in python conform to the iterator protocol, which basically means they provide two methods: __iter__() and __next__(). The __iter__ returns the iterator object and is implicitly …

  9. Iterate through a C++ Vector using a 'for' loop - Stack Overflow

    2012年10月3日 · 5 With STL, programmers use iterators for traversing through containers, since iterator is an abstract concept, implemented in all standard containers. For example, std::list …

  10. Difference between Python's Generators and Iterators

    What is the difference between iterators and generators? Some examples for when you would use each case would be helpful.