• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

collection Interface

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic