• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

collection Interface  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
author and iconoclast
Posts: 24203
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

Keep Coding!

Layne
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!