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 does the "yield" keyword do?

What is the use of the yield keyword in Python, and what does it do? For example, I'm trying to …

python iterator generator yield coroutine
How can I iterate over files in a given directory?

I need to iterate through all .asm files inside a given directory and do some actions on them. How can …

python iterator directory
How to iterate through two lists in parallel?

I have two iterables in Python, and I want to go over them in pairs: foo = (1, 2, 3) bar = (4, 5, 6) for (f, b) …

python list for-loop iterator
Iterate through a C++ Vector using a 'for' loop

I am new to the C++ language. I have been starting to use vectors, and have noticed that in all …

c++ coding-style for-loop iterator
Calling remove in foreach loop in Java

In Java, is it legal to call remove on a collection when iterating through the collection using a foreach loop? …

java loops iterator foreach
How to avoid "ConcurrentModificationException" while removing elements from `ArrayList` while iterating it?

I'm trying to remove some elements from an ArrayList while iterating it like this: for (String str : myArrayList) { if (someCondition) { …

java list arraylist iterator
ArrayIndexOutOfBoundsException when using the ArrayList's iterator

Right now, I have a program containing a piece of code that looks like this: while (arrayList.iterator().hasNext()) { //value …

java arraylist iterator indexoutofboundsexception
Build a Basic Python Iterator

How would one create an iterative function (or iterator object) in python?

python object iterator
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" …

c++ iterator vector
What exactly are iterator, iterable, and iteration?

What is the most basic definition of "iterable", "iterator" and "iteration" in Python? I have read multiple definitions but I …

python iterator iteration terminology iterable