wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt in Maop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt in Maop" Watch "Doubt in Maop" New topic

Doubt in Maop

sakthi moorthy
Ranch Hand

Joined: Oct 17, 2007
Posts: 54
Map is not in a collection interface , But Set , List are in collection interface. My doubt is What are all the Collection interface Operations do the Map can not Perform When Compare With Set , List
Kelvin Chenhao Lim
Ranch Hand

Joined: Oct 20, 2007
Posts: 513
Why not just take a look at the Collection and Map javadocs to find out for yourself?

As for the question of why Map is not a Collection, well, admittedly one can argue reasonably that a Map should indeed be considered some kind of Collection. But the designers of the Collections Framework ultimately decided that it's better to think of a Map not so much as a collection of objects, but rather as a relation between two collections. That's why the Map interface gives you accessors for the two underlying collections: keySet() and values(). You can then perform all your usual Collection operations on each of those two collections.

(However, Map also has an entrySet() method that muddles this view a little bit. You can read about that method in the javadoc, if you're not already familiar with it.)

SCJP 5.0
Don't get me started about those stupid light bulbs.
subject: Doubt in Maop
Similar Threads
Collection doubt
collection interface
Collection doubt
Why Map doesn't extend collection interface while List and Set can extend Collection interface