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

    Jul 17, 2018 · How to implement Iterable interface? To implement an iterable data structure, we need to: Implement Iterable interface along with its methods in the said Data Structure; Create …

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

    Mar 5, 2014 · The best reusable option is to implement the interface Iterable and override the method iterator(). Here's an example of a an ArrayList like class implementing the interface, in …

  3. Iterator Interface In Java - GeeksforGeeks

    Nov 9, 2020 · An Iterator in Java is an interface used to traverse elements in a Collection sequentially. It provides methods like hasNext(), next(), and remove() to loop through …

  4. Creating Custom Iterator in Java - Baeldung

    Mar 7, 2025 · An Iterator<E> is an interface in the Java Collections framework and provides methods that allow traversing through a collection. An Iterator instance can be obtained by …

  5. How to implement Iterator and Iterable Interface in Java

    Iterator is used to traverse and access elements of containers. Iterable interface are similar to iterators but makes use of for-each loop. In this tutorial, we will learn about iterator and iterable …

  6. java - How can I implement the Iterable interface? - Stack Overflow

    Oct 29, 2015 · Given the following code, how can I iterate over an object of type ProfileCollection? public class ProfileCollection implements Iterable { private ArrayList<Profile> m_Profiles; …

  7. A Guide to Iterator in Java - Baeldung

    Jan 8, 2024 · In this tutorial, we’re going to review the simple Iterator interface to learn how we can use its different methods. We’ll also check the more robust ListIterator extension which …

  8. Java Iterator Interface - Programiz

    In this tutorial, we will learn about the Java Iterator interface with the help of an example. All the Java collections include an iterator () method. This method returns an instance of iterator used …

  9. Iterator and Iterable in JavaJava Stories | Neelesh J - Medium

    Jul 7, 2024 · By implementing Iterable, a class signals that it can provide an iterator to iterate over its elements. To enable iteration over instances of a custom class, it should implement the...

  10. Iterator (Java SE 24 & JDK 24) - docs.oracle.com

    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Framework. Iterators differ from enumerations in two ways: Iterators allow the caller to remove …

  11. Some results have been removed
Refresh