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 basic concept of java?

547


What is the difference between the paint() and repaint() methods in java programming?

645


Is a string literal?

529


Why Java is not pure Object Oriented language?

662


Which class cannot be a subclass in java?

553






What is the maximum size of a string in java?

557


Why stringbuffer is faster than string?

556


What is a treeset class?

569


What is java and why do we need it? Explain

591


What is use of valueof () in java?

575


How many arguments can be passed to main ()?

530


What are the advantages of functions?

531


What is object cloning in Java?

642


What will be the output of round(3.7) and ceil(3.7)?

691


Is array size fixed in java?

554