File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "HashMap Doubt" Watch "HashMap Doubt" New topic

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

Joined: Oct 27, 2005
Posts: 19848

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.

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