how copy the hashmap object into arraylist at java program?

Answer Posted / venkat

hashMap.keySet().toArray(); // returns an array of keys
hashMap.values().toArray(); // returns an array of values

Is This Answer Correct ?    15 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a variable declaration?

531


What is the purpose class.forname method?

567


What is complexity and its types?

534


What is nested loop? What is dangling else condition in it?

583


When is the finalize() called?

709






What are the 6 functions?

521


What classes of exceptions may be caught by a catch clause in java programming?

709


What is string substring?

566


What is a nested class?

602


What is math floor in java?

479


Can we split string with in java?

539


What are the advantages of java?

519


How you can force the garbage collection?

545


What are the different ways to handle exceptions?

547


How do you execute a thread in java?

512