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 the difference between jdk, jre, and jvm?

782


What is an immutable class?

829


What is a nested structure?

716


Is the milky way in a void?

743


What are the rules for variable declaration?

683


What is the use of singleton class?

707


What is meant by null and void?

726


Why is stringbuffer thread safe?

791


What is the function of character?

751


What is meant by vector class, dictionary class, hash table class, and property class?

894


What is flag in python?

790


How do you represent a space in regex java?

717


What is a pointer and does java support pointers?

768


What is an arraylist in java?

696


What are different access specifiers in java? Explain

820