About 18,000 results
Open links in new tab
  1. Java | Implementing Iterator and Iterable Interface

    Jul 11, 2025 · To implement an Iterator, we need a cursor or pointer to keep track of which element we currently are on. Depending on the underlying data structure, we can progress …

  2. Creating Custom Iterator in Java - Baeldung

    Jun 27, 2025 · In this article, we looked at how to create a custom iterator in Java and apply it to our collections. This gives us better control over how we iterate over the collections.

  3. Iterator (Java Platform SE 8 ) - Oracle

    Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics. Method names have been improved. This interface is a member …

  4. Can we write our own iterator in Java? - Stack Overflow

    May 1, 2011 · You can implement your own Iterator. Your iterator could be constructed to wrap the Iterator returned by the List, or you could keep a cursor and use the List's get (int index) …

  5. Java - Iterator Implementation - Datacadamia

    The iterator implementation in Java is just an inner class that implements the iterator interface. In order to be able to use it in a for loop construction, the iterable interface must be implemented.

  6. Java Iterator - W3Schools

    Java Iterator An Iterator is an object that can be used to loop through collections, like ArrayList and HashSet. It is called an "iterator" because "iterating" is the technical term for looping. To …

  7. An example of implementing Iterable and Iterator in Java

    Download ZIP An example of implementing Iterable and Iterator in Java Raw Array.java import java.util.Iterator; import java.util.NoSuchElementException; // Introduction: // // This is an …