Hey there! any question in your mind? Ask It Now!.

Popular Categories





Best way to iterate a has map ?

+3 votes
97 views
asked in Programming by ishant (150 points)

How to iterate through a HashMap?

1 Answer

+3 votes
answered by neha (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.

commented by tester (1,550 points)
yes , i also think its a good way to iterate has map.

Related Questions

0 votes
0 answers 73 views
0 votes
1 answer 190 views
+2 votes
1 answer 171 views
–1 vote
0 answers 145 views
0 votes
0 answers 100 views
+2 votes
1 answer 877 views
+2 votes
1 answer 705 views
+2 votes
3 answers 303 views
asked in Programming by jatin Expert (3,823 points)
0 votes
1 answer 125 views
0 votes
0 answers 43 views
asked by CaptSaltyJack (1,140 points)

Not a Member yet?

Ask to Folks Login

My Account
442 Folks are online
2 members and 440 guest online
Your feedback is highly appreciated