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
Using callable statement how can you pass out parameters, explain with example?
How does map works in java?
Which container method is used to cause a container to be laid out and redisplayed in java programming?
Can constructor be static or final?
How many ways can we create the string object?
java Technical questions asked by JPMC
What is composition in java?
What are access specifiers available in java?
What if I write static public void instead of public static void in java?
How to create packages in java?
Is char a data type in java?
What happens if an exception is not handled in a program?
Why array is used in java?
Is an object null?
What is the difference between variable declaration and variable initialization?