About 50 results
Open links in new tab
  1. java - What is the difference between iterator and iterable and …

    Jul 28, 2011 · On the flip side, Iterable is another interface, which, if implemented by a class forces the class to be Iterable and is a target for For-Each construct. It has only one method …

  2. java - What is the Iterable interface used for? - Stack Overflow

    Jun 29, 2009 · 0 The Iterable is defined as a generic type. Iterable , where T type parameter represents the type of elements returned by the iterator. An object that implements this …

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

    Oct 29, 2015 · Iterable is a generic interface. A problem you might be having (you haven't actually said what problem you're having, if any) is that if you use a generic interface/class without …

  4. How to use Iterator/Iterable in Java? - Stack Overflow

    Sep 23, 2014 · The Iterable interface is usually implemented by a collection of some sort. In your case, it is the Prison class, not the PrisonCell that could be declared to implement …

  5. java - How can I make my class iterable so I can use foreach syntax ...

    Feb 2, 2014 · How can I make my class iterable so I can use foreach syntax? Asked 12 years ago Modified 5 years ago Viewed 54k times

  6. java - Why is the iterator method present in both Iterable and ...

    Jul 8, 2018 · To make the existing java.util.Collection and all it's descendent interfaces and classes compatible with the enhanced for loop, they made java.util.Collection extend …

  7. java - Implementing the Iterable interface - Stack Overflow

    Dec 3, 2014 · How "old" is the exam paper where you read this ? I'm asking because it's very likely that it was written before Java 5 was released (therefore, before the word "iterable" …

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

    May 1, 2011 · 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 …

  9. Convert Iterable to Stream using Java 8 JDK - Stack Overflow

    Oct 4, 2018 · 537 I have an interface which returns java.lang.Iterable<T>. I would like to manipulate that result using the Java 8 Stream API. However Iterable can't "stream". Any idea …

  10. Inheritance in java collection interfaces - Stack Overflow

    Jul 16, 2012 · The Collection interface extends Iterable. An abstract superclass implements the methods common to several classes, in the case of lists, it's AbstractList, with each concrete …