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

Popular Categories





Best way to iterate a has map ?

+3 votes
50 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 57 views
0 votes
1 answer 148 views
+2 votes
1 answer 141 views
–1 vote
0 answers 109 views
0 votes
0 answers 71 views
+2 votes
1 answer 861 views
+2 votes
1 answer 486 views
+2 votes
3 answers 280 views
asked in Programming by jatin Expert (3,823 points)
0 votes
1 answer 98 views
0 votes
0 answers 29 views
asked by CaptSaltyJack (1,140 points)

Not a Member yet?

Ask to Folks Login

My Account
699 Folks are online
49 members and 650 guest online
Your feedback is highly appreciated