• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what does entrySet return??

 
yuvraj kotegar
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it returns a set.

so does it contain both the 'key' and 'value' in case of hashmap??
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you take a look at the API documentation for the Map.entrySet() method it should be pretty obvious what exactly is returned.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic