Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do you iterate in Hashmap?

Answer Posted / varun

HashMap<String, String> loans = new HashMap<String, String>();
loans.put("home loan", "citibank");
loans.put("personal loan", "Wells Fargo");

for (String key : loans.keySet()) {
System.out.println("------------------------------------------------");
System.out.println("Iterating or looping map using java5 foreach loop");
System.out.println("key: " + key + " value: " + loans.get(key));
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between object state and behavior?

1002


What is chat area? Explain.

965


What restrictions are placed on the values of each case of a switch statement?

960


How primary key is implemented in Oracle?

2385


Which class is the immediate superclass of the menucomponent class?

1154


Define prototype?

1004


What is glasgow?

1004


Will the general public have access to the infobus apis?

1005


Is the ternary operator written x : y ? Z or x ? Y : z ?

1056


Why do I get a duplicate name error when loading a jar file?

1082


Explain RMI Architecture?

1043


What is the difference between long.class and long.type?

1007


Name the eight primitive java types.

1067


What is a modular application?

1014


Where can I find seam examples and documentation?

1050