Questions tagged as 'iterator'

1
answer

How does Spliterator work in Java 8?

In Java 8 (which was released in March 2014), there is a new interface called Spliterator . It has a similar purpose to the Iterator , but it is designed to perform iterations in parallel . However, even after reading a lot about this inter...
asked by 16.12.2013 / 05:30
2
answers

What is Iterator?

Studying STL in C ++, I almost always encounter the term iterator , example: std::vector<int>::iterator it; What is the function of a iterator ?     
asked by 08.11.2016 / 19:44
2
answers

How to check if a value is iterable by foreach in PHP?

In PHP, not only arrays are iterable, but also some specific objects. For example, objects that implement the interface Iterator or even IteratorAggregate . Another example is stdClass and ArrayObject , which ite...
asked by 11.01.2017 / 12:42
1
answer

What is the EmptyIterator class for?

In the PHP documentation, there is a class called EmptyIterator When I look at the documentation for the EmptyIterator::rewind() method, it says:    No operation, nothing to do. (No operation, nothing to do) And the...
asked by 03.06.2015 / 13:34
1
answer

With an iterator / generator in javascript?

In PHP we have the Iterators and the Generator . Example Iterator: $f = new FileSystemIterator(__DIR__); foreach($f as $file) { echo $file->getFilename(); } Example Generator: function sequence($start, $end) {...
asked by 08.10.2015 / 17:06
1
answer

Why should not iterate a hashmap?

I've been doing a project and one of my colleagues mentioned that iterating hashmaps is something to avoid and instead should use hashmap . However, I think the hashmap's versatility of being able to save strings as a key allows you to...
asked by 10.01.2018 / 21:25
2
answers

How do I know if a value is iterable in Python?

How can I do to check in Python if a particular value is iterate? What determines that a given type can be iterate? For example, how do you figure this out in the case below? a = 1 b = 'Uma string' c = [1, 2, 3] d = xrange(1, 10)...
asked by 11.01.2017 / 13:02
2
answers

How to compare the value of a HashMapchave, value with a variable?

I have a HashMap aluno<Integer, Float> , where the key Integer will be the student's enrollment number, and the Float value will be the student's grade. I got the grades average using Iterator , but now I need...
asked by 20.11.2014 / 15:58
1
answer

How do I switch between the next element and the previous element of a ListIterator with just one click?

I have a list of words stored in my listaPalavra variable already initialized with values, of type ArrayList<T> : listaPalavra.add("Palavra 1"); listaPalavra.add("Palavra 2"); listaPalavra.add("Palavra 3"); listaPalavra.add(...
asked by 31.10.2016 / 02:11
3
answers

How does the variable p work in this code?

I do not know how the variable p of the loop while is working on this code. If the variable p is the iteration variable, why does the exercise also use a p variable within while to store s.find( "tigre"...
asked by 05.05.2017 / 21:28