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

Popular Categories





Best way to iterate a has map ?

+3 votes
102 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 81 views
0 votes
1 answer 201 views
+2 votes
1 answer 177 views
–1 vote
0 answers 153 views
0 votes
0 answers 111 views
+2 votes
1 answer 905 views
+2 votes
1 answer 847 views
+2 votes
3 answers 314 views
asked in Programming by jatin Expert (3,823 points)
0 votes
1 answer 132 views
0 votes
0 answers 50 views
asked by CaptSaltyJack (1,140 points)

Not a Member yet?

Ask to Folks Login

My Account
693 Folks are online
6 members and 687 guest online
Your feedback is highly appreciated