Which method in the `Iterable` interface must be implemented?

Java Professional Easy

Java Professional — Easy

Which method in the `Iterable` interface must be implemented?

Key points

  • The `iterator()` method is essential for iterating over collections.
  • `hasNext()` and `next()` are methods in the `Iterator` interface, not `Iterable`.
  • `forEach()` is a default method in the `Iterable` interface, not a required method.

Ready to go further?

Related questions