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 are the disadvantages of indexes in oracle?

1867


What is the java virtual machine?

584


What is a protected class in java?

542


What is stringreader?

527


What is the difference between array and array list in java?

607






What is the final variable?

583


Why webdriver is an interface?

583


Can we write class inside a class in java?

553


What is a boolean expression in java?

537


What are the types of strings?

568


How can we create a thread in java?

589


Why we override equals() method?

569


What is the diffrence between inner class and nested class?

564


What is parseint?

540


What is the maximum size of byte array in java?

542