Timothy, comrade, Set is a Collection
Hashset extends:
Object<-AbstractCollection<-AbstractSet<-HashSet
HastSet implements Collection and Set interfaces.
Maybe you are a bit confused with Map, because Map is not a Collection.
But the method myMap.entrySet() does not return a Map, but a Set, and Set is indeed a Collection.
Hence, I am just using an inheritance principle that I hope you understand, because I cannot explain it here. I just can tell you this:
If...
Animal<-Mammal<-Tiger
Animal<-Mammal<-Dog
Then all dogs are Mammals and all Tigers are Mammals. So If I had method that accepts a Mammal as parameter I could pass wheter a Tiger or a Dog, because both a Mammals. It is the same principle with Collections.
All Sets and Lists are actually a Collection, so wherever you see a Collection you can substitute it for a Set or List.
However if you still do not know this basic principles I suggest you to visit
The Java Tutorial and get yourself started.
Regards,
Edwin Dalorzo.
Good luck, pal.
[ January 16, 2006: Message edited by: Edwin Dalorzo ]