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

What is a predicate method?

1027


Why java is a platform independent? Explain

1100


What is the difference between a static and a non-static inner class in java programming?

1088


Can list contain null in java?

1093


What is %02d?

1092


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

1019


What is stored procedure. How do you create stored procedure ?

1957


Is intellij better than eclipse?

1102


What happens if we don’t override run method ?

1015


Explain an algorithm to find depth of a binary tree.

1052


How to check if linked list contains loop in java?

908


Why put method is idempotent?

923


Can you use abstract and final both with a method?

1118


What is the importance of finally block in exception handling?

1037


Do we have pointers in java?

1014