+3 votes
509 views
in Programming by (150 points)

How to iterate through a HashMap?

1 Answer

+3 votes
by (560 points)
you can iterate liks also
 
Map<String, String>objConfiguration = new HashMap<String,String>();
java.util.Set<String> set = objConfiguration.keySet();
Iterator<String> itr = set.iterator();
while(itr.hasNext()){
String key = itr.next();
String value = objConfiguration.get(key);
//you can put any condition here.
}

i hope you got the point.

0
by (1.6k points)
yes , i also think its a good way to iterate has map.

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated