aspose file tools*
The moose likes Beginning Java and the fly likes HashMap Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "HashMap Doubt" Watch "HashMap Doubt" New topic
Author

HashMap Doubt

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Is there a way to get the value in a HashMap without using the

get(Object key) method.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
Well, there is the values() method which gives you a Collection containing all the values.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

And the entrySet() method returns a set with instances of Map.Entry. You can use their getValue() method to get the value, and the getKey() method to get the key.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Thanks for your response.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HashMap Doubt