Top "Iterator" questions

An iterator is an object-oriented programming pattern that allows traversal through a collection, agnostic of the actual implementation or object addresses in physical memory.

What is the most effective way to get the index of an iterator of an std::vector?

I'm iterating over a vector and need the index the iterator is currently pointing at. AFAIK this can be done …

c++ iterator coding-style
Iterate over object keys in node.js

Since Javascript 1.7 there is an Iterator object, which allows this: var a={a:1,b:2,c:3}; var it=Iterator(a); function …

javascript node.js iterator
Convert Iterator to ArrayList

Given Iterator<Element>, how can we convert that Iterator to ArrayList<Element> (or List<Element&…

java list arraylist iterator
How to get a reversed list view on a list in Java?

I want to have a reversed list view on a list (in a similar way than List#sublist provides a …

java list collections iterator reverse
Can we write our own iterator in Java?

If I have a list containing [alice, bob, abigail, charlie] and I want to write an iterator such that it …

java iterator
Iterating over Typescript Map

I'm trying to iterate over a typescript map but I keep getting errors and I could not find any solution …

typescript iterator maps
Sorting a vector in descending order

Should I use std::sort(numbers.begin(), numbers.end(), std::greater<int>()); or std::sort(numbers.rbegin(), numbers.…

c++ sorting stl vector iterator
Python list iterator behavior and next(iterator)

Consider: >>> lst = iter([1,2,3]) >>> next(lst) 1 >>> next(lst) 2 So, advancing the iterator …

python list iterator iteration
How to convert an iterator to a stream?

I am looking for a concise way to convert an Iterator to a Stream or more specifically to "view" the …

java iterator java-8
How to read one single line of csv data in Python?

There is a lot of examples of reading csv data using python, like this one: import csv with open('some.…

python file csv iterator next