Sunday, January 6, 2019

Both Iterator and Iterable are interfaces in Java Collection Framework. Here are some differences:
Iterator: Iterator  is an interface that manages iteration over an Iterable. It maintains a state of where we are in the current iteration, and knows what the next element is and how to get it. See API here
Iterator lets you check if it has more elements using hasNext() and move to the next element (if any) using next().
This interface is a member of the Java Collections Framework. It has the methods hasNext(), next(), remove()
Iterable: Implementing this interface allows an object to be the target of the "for-each loop" statement. See Iterable API here.
An iterable produces iterators

0 comments:

Post a Comment

selenium-repo by venu

Blog helps to a student or IT employee to develop or improve skills in Software Testing.
For Online Classes Email us: gadiparthi122@mail.com

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts