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
How do you sort an array in java?
Define locale.
What is a private class in java?
What are the characteristics of Final,Finally and Finalize keywords.
How do you create a reference in java?
Explain different types of wrapper classes in java?
What are the concepts of 'OOPS'?
What is a instance variable in java?
What are the restrictions that are applied to the java static methods?
What is the difference between compile-time polymorphism and runtime polymorphism?
What does a boolean method return?
What are java packages? What is the significance of packages?
How do you declare an array in java?
What is meant by object oriented programming – oop?
Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)