The Java APIs provide many implementations. They're not generally public classes, so their names aren't visible. But calling, for example, ArrayList.iterator() will return an instance of a class, provided by the Java APIs, which implements the Iterator interface.
Originally posted by Rajnarayan Deenadayalan: How Collection interfaces are implemented? (i.e)Iterator is an iterface but we are able to use the methods of Iterator without implementing how it is possible .
Typically, the Collection interface is not implemented directly. The Collections Framework includes many subinterfaces that extend Collection, such as List, Map, and Set, which are in turn extended by yet other interfaces. These subinterfaces are typically the ones that you see implemented by classes such as ArrayList, TreeSet, and HashMap, to name a few.
The tutorials and documentation for the Collections Framework is quite extensive. You should probably start with
As Ernest pointed out, someone, somewhere DOES implement the Iterator interface. Typically the exact class that implements it is unknown.the Collections trailin Sun's Java Tutorial to get an idea of how the different Collection classes work. You should also familiarize yourself with the Java API documentation so you can look up what classes and methods are available for you to use.
I hope this answers your question. If not, please let us know.