iteration in hashmap
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srinivas_reddy
Posted On:   Friday, February 17, 2006 06:44 AM

could anybody help me in iterating throught the hashmap and getting all the values without using key.

Re: iteration in hashmap

Posted By:   WarnerJan_Veldhuis  
Posted On:   Friday, February 17, 2006 11:08 AM

What about just iterating over hashMap.values() ???

Re: iteration in hashmap

Posted By:   Anonymous  
Posted On:   Friday, February 17, 2006 06:57 AM

might be this will help you,


java.util.HashMap hashMap = new java.util.HashMap();
String loginid = "Bunty";

hashMap.put(loginid,loginid);
String userid="Bunty";
for(Iterator e = hashMap.keySet().iterator(); e.hasNext();){
String key = e.next().toString();
String value = hashMap.get(key).toString();
if(value.equals(userid)){
System.out.println("--Exit---");
}
}
About | Sitemap | Contact