wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes what does entrySet return?? 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 » Java » Beginning Java
Bookmark "what does entrySet return??" Watch "what does entrySet return??" New topic
Author

what does entrySet return??

yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
it returns a set.

so does it contain both the 'key' and 'value' in case of hashmap??
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1753
    
    7

If you take a look at the API documentation for the Map.entrySet() method it should be pretty obvious what exactly is returned.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

Yuvraj,
Yes. The JavaDoc for Java 5+ shows this a bit more clearly. It says the return type is:
Set<Map.Entry<K,V>>

This is a Set of Entry objects. The Entry class is defined within Map and has the key/value pairs.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what does entrySet return??
 
Similar Threads
Barn Burning Patterns
WA #2 ..... word association
Need help understanding generics.
How low level do YOU code ?
Jboss in Action question: migration from other Application Servers