Tags » Iterator

#1,197 - Iterator Can Generate Enumerable of Infinite Length

An iterator can be written to generate an enumerable sequence of infinite length.  The iterator will execute for as long as client code continues to request the next element in the sequence. 118 more words


How to iterate through a HashMap containing an array

When one starts using the Java Iterator class to go through a HashMap, it is easy to forget that if you insert an array into your HashMap, you have to “go down” another iteration level. 62 more words


#1,195 - Iterator Produces Only as Many Elements as Are Needed

When implementing an iterator, you write code that generates a sequence of elements using the yield return statement to return each consecutive element.

The full body of the iterator code may not execute.   151 more words


Parallel Streams and Spliterators

Today we are going to look at one of the aspects where using streams is a real win – when we need to thread work. As well as parallel streams, we will also look at Spliterators which acts as the machinery which pushes elements into the pipeline. 2,605 more words

Java 8 Functional Programming

Iterator Part - II

In this part of the lesson on Iterator, we will look into how Iterator is implemented by different collections and some of it most common uses. 784 more words


Iterator Part - I

What is an Iterator ?

List and Set Collections provide iterators that allow traversing the collection in a sequential manner.The specifications for creating an iterator is provided via the Iterator interface. 548 more words