dcsimg
how to iiterate through hash map using keys
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srinivas_reddy
Posted On:   Friday, March 3, 2006 07:36 PM

I want to iterate through the hash map using the key. can any one give me an idea of how to do that...

Re: how to iiterate through hash map using keys

Posted By:   rahul123  
Posted On:   Wednesday, December 18, 2013 09:35 PM

Set s1 = hashmap.entrySet();
Iterator itr = s1.iterator();
while(itr.hasNext()
{
Map.Entry m1 = (Map.Entry).itr.next();
System.out.println(m1.getValue+ "................"+m1.getKey())l;
}

Re: how to iiterate through hash map using keys

Posted By:   Anonymous  
Posted On:   Thursday, March 23, 2006 02:06 PM

Iterator iterator = map.entrySet().iterator();
Map.Entry entry = null;
entry = ( Map.Entry ) loanIterator.next();

it gives better performance than keyset.iterator();

because your objects are alreasdy mapped together.. So no need to check hash table.

Re: how to iiterate through hash map using keys

Posted By:   WarnerJan_Veldhuis  
Posted On:   Sunday, March 5, 2006 04:33 PM

myHashMap.keySet.iterator()
About | Sitemap | Contact