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
What is a predicate method?
Why java is a platform independent? Explain
What is the difference between a static and a non-static inner class in java programming?
Can list contain null in java?
What is %02d?
Is it compulsory for a try block to be followed by a catch block in java for exception handling?
What is stored procedure. How do you create stored procedure ?
Is intellij better than eclipse?
What happens if we don’t override run method ?
Explain an algorithm to find depth of a binary tree.
How to check if linked list contains loop in java?
Why put method is idempotent?
Can you use abstract and final both with a method?
What is the importance of finally block in exception handling?
Do we have pointers in java?