Sample code to retrieve objects from HashMap in sorted
ascending order?

Answers were Sorted based on User's Feedback



Sample code to retrieve objects from HashMap in sorted ascending order?..

Answer / murli

Map hm = new HashMap();
//add values to hashmap
Map tm = new TreeMap(hm);
//Iterate keySet in tm

Is This Answer Correct ?    9 Yes 2 No

Sample code to retrieve objects from HashMap in sorted ascending order?..

Answer / amit badgujar

Yes it is correct

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

What’s the difference between the methods sleep() and wait()?

0 Answers  


Describe inheritance as applied to java?

4 Answers  


What is the use join() in Threads ?

5 Answers   HCL,


What are the string methods in java?

0 Answers  


what type of questions asked for barclays technologies pune please send urgent

0 Answers  






What are the differences between stringbuffer and stringbuilder?

0 Answers  


What is indexof?

0 Answers  


What is classes in java?

0 Answers  


What is the replace tool?

0 Answers  


What is meant by JVM? Is JVM platform independent or not?

0 Answers   Wipro,


If you are reviewing the code of your team members, what points will you look at, assuming the performance of the application is not so great

2 Answers   KPIT,


We can write any Java Logics in our JSP. Then why we are using servlets(Controller Layer) to interact with the DAO ?

6 Answers   TCS,


Categories