How to iterate map in collection framework?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is .sh file in mac?

549


Explain what is a view?

590


What is tabular form?

537


What degree do database administrators need?

272


What are git repository hosting services you used?

1






What is protection boundary?

680


What is the effect of the internet of things have on healthcare segment?

1


What are merits and demerits of systems supporting multiple file structure and systems supporting a stream of bytes?

603


What are the function modules used in a sap script driver program?

561


How much does it cost to upgrade to windows 10?

522


Who maintains the CSS specifications?

349


Why cout is used in c++?

557


How do you update excel?

271


What are the important characteristics of soap envelope element?

485


What is a calculated field in excel?

415