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 copy the hashmap object into arraylist at java program?

Answer Posted / abhinaw

HashMap hm = new HashMap();
hm.put("1", "a1");
hm.put("2", "a2");
hm.put("3", "a3");
hm.put("4", "a4");
hm.put("5", "a5");

ArrayList list = new ArrayList();
list.addAll(hm.entrySet());
System.out.println(list);

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you sort an array in java?

974


Define locale.

1022


What is a private class in java?

1031


What are the characteristics of Final,Finally and Finalize keywords.

1157


How do you create a reference in java?

951


Explain different types of wrapper classes in java?

998


What are the concepts of 'OOPS'?

1058


What is a instance variable in java?

1026


What are the restrictions that are applied to the java static methods?

968


What is the difference between compile-time polymorphism and runtime polymorphism?

976


What does a boolean method return?

1205


What are java packages? What is the significance of packages?

988


How do you declare an array in java?

1032


What is meant by object oriented programming – oop?

959


Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)

1319