Java Iterator

Java Collections

Java Enumeration, Iterator, ListIterator and Spliterator

In Java, all types of enumerations and iterators (such as Iterator, ListIterator, SplitIterator) are simply navigational cursors and the main purpose of these cursors is to iterate over the elements of the collection. Each cursor has its own features, advantages and disadvantages. In this article, we will walk through these iterators, important methods, advantages, and …

Java Spliterator (with Examples)

Unlike traditional iterators, Spliterator is designed with parallelism in mind and mainly helps in parallel processing when the collection or stream has a large number of elements.

Java ListIterator (with Examples)

The Java ListIterator interface is a bidirectional iterator that iterates over the elements in both forward and backward directions.

Guide to Java Iterator

Java Iterator interface is used to iterate over the elements of a Collection (List, Set or Map). The Iterator helps in retrieving the elements from the specified collection one by one and optionally performs operations over each element. Java Iterator was first introduced in Java 1.2 as a replacement of Enumerations. …

Internal vs. External Iteration in Java

Learn the difference between internal iteration and external iteration in Java with examples. 1. External Iteration Till Java 7, the collections framework relied on the concept of external iteration where the Collection provides a means to enumerate its elements by implementing the Iterator interface. The clients use the iterator to …

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.