How to iterate map in collection framework?



How to iterate map in collection framework?..

Answer / navin kumar

Map<String,String> map = new HashMap<String,String>();
map.put("A","Rohan");
map.put("C","Sohan");
map.put("B","Ram");

for(String key : map.entrySet()){
sop(key);//A,C and B as key
sop(map.get(key))//Rohan,Sohan and Ram as values
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Software Interview Questions

A bank offers 5% compound interest calculated on half-yearly basis. A customer deposits Rs. 1600 each on 1st January and 1st July of a year. At the end of the year, the amount he would have gained by way of interest is:

0 Answers   Zoho,


Where we can activate Rebates?

0 Answers  


How Accounting determination happened?

0 Answers  


1 1 12 21 123 321 1234 4321 1234554321

0 Answers  


How to Create a New Table?

0 Answers  






How to Populate a Table With Rows?

0 Answers  


where will movement type get assigned?

0 Answers  


How to find the Table name for the Specific Field?

0 Answers  


How can you load large amounts of data from flat-text files?

0 Answers  


Can we assign more than one Shipment Cost in Delivery Type?

0 Answers  


How can you determine if a ray intersects a sphere? The more efficient your solution, the better.

0 Answers  


To fill a tank, 25 buckets of water is required. How many buckets of water will be required to fill the same tank if the capacity of the bucket is reduced to two-fifth of its present ?

0 Answers   Zoho,


Categories