This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 19656
    
  18

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.
 
 
subject: HashMap Doubt
 
Similar Threads
WA #1.....word association
Hashtable
switch on String
HashMap
Problem with Java References